Been searching forums and making phone calls to try to figure out why the direct link php ad script is not being interpreted in my sites.
The sites are http://sergeantbrettscoffee.mobi and http://mobisize.mobi They are hosted on GoDaddy in a shared hosting account.
I have used several php mail scripts in my other sites in the same account with no problem.
Even a simple echo wont't work.
I've tried putting a .htaccess file in the folder with AddType application/x-httpd-php .htm .html .php and variants, including one with .wml and also with the file extensions without the dots. I keep getting parse errors.
echo '<p align="center">[size="1"]';
/* editable area */
$mob_mode = 'live'; // change mode from "test" to "live" when you are done testing
$mob_alternate_link = '[url]http://lavalair.net';[/url] // 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']);
if ($mob_mode=='test')
$mob_m = "&m";
$mob_url = '[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&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;
}
echo '[/size]</p>';
$ret = "\n</card>\n</wml>";
return $ret;
}
function xhtml_footer()
{
echo '<h3 align="center">[size="1"]';
/* editable area */
$mob_mode = 'live'; // change mode from "test" to "live" when you are done testing
$mob_alternate_link = '[url]http://lavalair.net';[/url] // 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']);
if ($mob_mode=='test')
$mob_m = "&m";
$mob_url = '[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&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;
}
echo '[/size]</h3>';
$ret = "\n</body>\n</html>";
return $ret;
}
function xhtml_header($page_title, $page_style="")
{
thats my admob code think its the same just make sure its right on your scripts, also you have your correct site id in the $mob_url = 'http://ads.admob.com/ad_source.php?s=SITE ID HERE&u='.$mob_ua.'&i='.$mob_ip.$mob_m; bits and also that your ads are in live mode and not test
echo '<p align="center">[size="1"]';
/* editable area */
$mob_mode = 'live'; // change mode from "test" to "live" when you are done testing
$mob_alternate_link = '[url]http://lavalair.net';[/url] // 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']);
if ($mob_mode=='test')
$mob_m = "&m";
$mob_url = '[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&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;
}
echo '[/size]</p>';
$ret = "\n</card>\n</wml>";
return $ret;
}
function xhtml_footer()
{
echo '<h3 align="center">[size="1"]';
/* editable area */
$mob_mode = 'live'; // change mode from "test" to "live" when you are done testing
$mob_alternate_link = '[url]http://lavalair.net';[/url] // 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']);
if ($mob_mode=='test')
$mob_m = "&m";
$mob_url = '[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&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;
}
echo '[/size]</h3>';
$ret = "\n</body>\n</html>";
return $ret;
}
function xhtml_header($page_title, $page_style="")
{
thats my admob code think its the same just make sure its right on your scripts, also you have your correct site id in the $mob_url = 'http://ads.admob.com/ad_source.php?s=SITE ID HERE&u='.$mob_ua.'&i='.$mob_ip.$mob_m; bits and also that your ads are in live mode and not test
Many thanks. When I saw the echo at the top of your script, it led me in the right direction. I converted all the pages into php, did some cleaning up, and voila, it all worked.
do we have to edit the admob add code somewhere? i have noticed that time to time my site gives errors. i used the admob php curl code and made a php file in included in on my page is there something wrong? External image (may be gone)
do we have to edit the admob add code somewhere? i have noticed that time to time my site gives errors. i used the admob php curl code and made a php file in included in on my page is there something wrong? External image (may be gone)
time to time your site gives errors,because you mess up the codes,files etc.
change $mob_mode = 'live';
add here your SITE ID
$mob_url = 'http://ads.admob.com/ad_source.php?s=SITE ID
include the .php file like include("ad.php");
and to test if you admob account get live ads,check by using the echo" <a href="...........</a>; link