Landing page check... PHP Script

Status
Not open for further replies.

smaxor

New member
Oct 17, 2006
2,514
87
0
San Diego
I posted this pver on Andrew's thread in "shooting the shit", but I thought It would be worth making it's own thread. So that you don't end up sending traffic to dead or redirected campaigns... like those dreaded azg smilies. I wrote this little page checking script.

Put all your offers in a db table like with fields: html, url, desc, company, affid

Then insert the offers you are running with the copied html from the source of the landing page. Then run this script on a cron and it'll check if the landing page has changed. If it changes it'll email you. Then you can go see what's going on.

Someone else could ad a sql dump file to this as well I'm just to lazy. I didn't debug it so it might have an error or two but you get the basic idea!

<?

DBConnect();

$sql = "SELECT * FROM offers";
$sql_out = mysql_query($sql) or die(mysql_error());

while ( $row = mysql_fetch_assoc($sql_out)){

$orig_html = $row['html'];
$affiliate_url = $row['url'];
$description = $row['desc'];
$company = $row['company'];
$affiliate_id = $row['affid'];

$scrapedhtml = file_get_contents($affiliate_url);
$compare_result = strcmp( $scrapedhtml,$orig_html);
if(!$compare_result){
mail('changes@mail.com','Offer '.$description.' has changed!',"Your link for ".$description." has changed. It's hosted by ".$company." under affiliate ID".$affid.". Check this url ".$affiliate_url );
}
}
?>
 


Good stuff, but maybe you should modify it so that non-US affiliates can use a US proxy to check the offers.
 
Sure if you have Curl installed just swap out:

"$scrapedhtml = file_get_contents($affiliate_url);"

with:

$ch = curl_init($affiliate_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, '123.123.123.123:3843);
$scrapedhtml = curl_exec($ch);
curl_close($ch);

and you're all proxied up!
 
Status
Not open for further replies.