what if ur running ads on ur site, and now site is live, how can i make a coding that if no site is running i can have my own random links on my site?
FOR EXAMPLE, THE ADMOB CODING:
<?php
/* editable area */
$mob_mode = 'test'; // change mode from "test" to "live" when you are done testing
$mob_alternate_link = ''; // use this to set a default link to appear if AdMob does not return an ad.
/* end editable area */
//used for ad targeting
$mob_contents = '';
$mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
$mob_ip = urlencode($_SERVER['REMOTE_ADDR']);
$mob_m = '';
if ($mob_mode=='test')
$mob_m = "&m";
$mob_url = 'http://ads.admob.com/ad_source.php?s=a147e97a3ca3d3a&u='.$mob_ua.'&i='.$mob_ip.$mob_m;
@$mob_ad_serve = fopen($mob_url,'r');
if ($mob_ad_serve) {
while (!feof($mob_ad_serve))
$mob_contents .= fread($mob_ad_serve,1024);
fclose($mob_ad_serve);
}
$mob_link = explode("><",$mob_contents);
$mob_ad_text = $mob_link[0];
$mob_ad_link = $mob_link[1];
if (isset($mob_ad_link) && ($mob_ad_link !='')) {
//display AdMob Ad
echo '[url="'. $mob_ad_link .'"]'. $mob_ad_text . '[/url]';
}
else {
//no AdMob ad, display alternate
echo $mob_alternate_link;
}
?>