admob in wapdesire v2

Started on the old forum in April 2010 · view the original in the archive · old links redirect here

10 replies · 789 views · started 16 years ago · 1 min read

5 participants
JoEsaR Junior · 28 posts #1

i donno whether this code is not working or admob have problem..anybody can help me?i use this code but the ads not appear..

function mobads()
{
$mob_mode = "test";
$mob_alternate_link = "<a class=\"link\" href=\"http://wapdesire.com\">Best Web n Wap Community</a>";

$mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
$mob_ip = urlencode($_SERVER['REMOTE_ADDR']);

if ($mob_mode=='live')
$mob_m = "&m";
$mob_url = 'http://ads.admob.com/ad_source.php?s=a147bceef2a4c2a&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 !=''))
$ret = "<a class=\"link\" href=\"$mob_ad_link\">$mob_ad_text</a>";
else
$ret = $mob_alternate_link;

return $ret;

}

it only show Best Web n Wap Community

JoEsaR Junior · 28 posts #3
function mobads() 
{ 
$mob_mode = "test"; 
$mob_alternate_link = "<a class=\"link\" href=\"http://wapdesire.com\">Best Web n Wap Community</a>"; 

$mob_ua = urlencode(getenv("HTTP_USER_AGENT")); 
$mob_ip = urlencode($_SERVER['REMOTE_ADDR']); 

if ($mob_mode=='live') 
$mob_m = "&m"; 
$mob_url = 'http://ads.admob.com/ad_source.php?s=a147bceef2a4c2a&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 !='')) 
$ret = "<a class=\"link\" href=\"$mob_ad_link\">$mob_ad_text</a>"; 
else 
$ret = $mob_alternate_link; 

return $ret; 

} 

do u mean change this :

$mob_mode = "test"; 
$mob_alternate_link = "<a class=\"link\" href=\"http://wapdesire.com\">Best Web n Wap Community</a>";

to this :

$mob_mode = "live"; 
$mob_alternate_link = "<a class=\"link\" href=\"http://wapdesire.com\">Best Web n Wap Community</a>";

i have do it but it still show

Best Web n Wap Community

JoEsaR Junior · 28 posts #5

Xenax wrote: Yess, i mean like that. Have you already registered to admob and put your publisher id at "s" variable correctly?

yes i am.. this is my publisher id : a14b2b49a740e42 and i put it like this

function mobads()
{
$mob_mode = "live";
$mob_alternate_link = "<a class=\"link\" href=\"http://wapdesire.com\">Best Web n Wap Community</a>";

$mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
$mob_ip = urlencode($_SERVER['REMOTE_ADDR']);

if ($mob_mode=='live')
$mob_m = "&m";
$mob_url = 'http://ads.admob.com/ad_source.php?s=a14b2b49a740e42='.$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 !=''))
$ret = "<a class=\"link\" href=\"$mob_ad_link\">$mob_ad_text</a>";
else
$ret = $mob_alternate_link;

return $ret;

}

but the code still not appear..

woody Developer · 176 posts #6

JoEsaR wrote: yes i am.. this is my publisher id : a14b2b49a740e42 and i put it like this

function mobads()
{
$mob_mode = "live";
$mob_alternate_link = "<a class=\"link\" href=\"http://wapdesire.com\">Best Web n Wap Community</a>";

$mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
$mob_ip = urlencode($_SERVER['REMOTE_ADDR']);

if ($mob_mode=='live')
$mob_m = "&m";
$mob_url = 'http://ads.admob.com/ad_source.php?s=a14b2b49a740e42='.$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 !=''))
$ret = "<a class=\"link\" href=\"$mob_ad_link\">$mob_ad_text</a>";
else
$ret = $mob_alternate_link;

return $ret;

}

but the code still not appear..

are you calling the function on the page you want the ad displaying?

you need to add

mobads();

where you want the ads to appear

JoEsaR Junior · 28 posts #7

woody wrote: are you calling the function on the page you want the ad displaying?

you need to add

mobads();

where you want the ads to appear

yes i put that code at header..put only show

Best Web n Wap Community

lee27 Developer · 63 posts #9

easier way i used do it was this put ya code from admob into admobcode.php and upload it ya site docs with rest and then ad this

?>
<? include ('admobcode.php'); ?>
<?php

and anywhere u put it the ads will show on site

using name geordielee now

JoEsaR Junior · 28 posts #10

lee27 wrote: easier way i used do it was this put ya code from admob into admobcode.php and upload it ya site docs with rest and then ad this

?>
<? include ('admobcode.php'); ?>
<?php

and anywhere u put it the ads will show on site

i have also try this way..but the ads also not appear..maybe because i use freehostia.com free hosting..

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close