Dynadot โ€” .com Registration $8.99

.mobi Admob Direct Link setup help please!

Spaceship Spaceship
Watch
I currently have the links page enabled and want to upgrade it to the direct link. Here's my source code:

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="max-age=3000" />
<title>
Antioxidants.mobi
</title>
<meta http-equiv="Content-Style-Type" content="text/css; charset=charset=UTF-8" />
<meta name="keywords" content="antioxidants, health, nutrition, vitamins, supplements, resveratrol, melatonin, quercetin" />
<meta name="description" content="Antioxidant information you can trust" />
<style type="text/css">A:link {color:white;}
A:visited {color:white;}

body {background-color: #330099}

</style>

<style type="text/css">


p
{
border-bottom: medium solid #FFFFFF
}


</style>
</head>
<body>
<div>

<a href="http://www.antioxidants.mobi/fruits.html">Fruits</a><br /><br />
<a href="http://ads.admob.com/link_list.php?s=a14632421c5256a">Great Mobile Sites</a>

<p><span style="color: yellow;">ยฉ 2007 Antioxidants.mobi</span></p>
<a href="http://www.antioxidants.mobi/disclaimer.html">Disclaimer</a>
</div>
</body>
</html>
-----------------
I have no idea which of the Admob pages I should use (PHP, JSP, CGI/Perl, VB.net, C#, Ruby on Rails). I don't know anything other than html and css, so this is all gibberish to me.

Help is greatly appreciated! :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Use PHP code. First make sure that your hosting provider does support PHP though. Copy the code where you want the ads to be displayed and save the file as .php ( index.php in this case). I would suggest make another test page first to see it works before chaging your index page. Let me know if you need more info.

Vcool
 
0
•••
Thank you kindly Vcool, I'll try that out right now :)

Sorry to bother you again... I ended up with this:

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="max-age=3000" />
<title>
Antioxidants.mobi
</title>
<meta http-equiv="Content-Style-Type" content="text/css; charset=charset=UTF-8" />
<meta name="keywords" content="antioxidants, health, nutrition, vitamins, supplements, resveratrol, melatonin, quercetin" />
<meta name="description" content="Antioxidant information you can trust" />
<style type="text/css">A:link {color:white;}
A:visited {color:white;}

body {background-color: #330099}

</style>

<style type="text/css">


p
{
border-bottom: medium solid #FFFFFF
}


</style>
</head>
<body>
<div>
<?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_ua = urlencode(getenv("HTTP_USER_AGENT"));
$mob_ip = urlencode($_SERVER['REMOTE_ADDR']);

if ($mob_mode=='test')
$mob_m = "&m";

$mob_url = 'http://ads.admob.com/ad_source.php?s=a14632421c5256a&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 '<a href="'. $mob_ad_link .'">'. $mob_ad_text . '</a>';
}
else {
//no AdMob ad, display alternate
echo $mob_alternate_link;
}
?>
<a href="http://www.antioxidants.mobi/fruits.html">Fruits</a><br /><br />

<p><span style="color: yellow;">ยฉ 2007 Antioxidants.mobi</span></p>
<a href="http://www.antioxidants.mobi/disclaimer.html">Disclaimer</a>
</div>
</body>
</html>

-----

however, when I try to put that through the FTP client, it ends up showing only a blank page. I did a bit off Googling and it seems that my hosting (godaddy economy) supports php.
 
Last edited:
0
•••
Everything looks ok. Did you save the file as .php and not .xhtml/.html? Can you point to the file on your server so I can take a look?

Thanks,

vcool
 
0
•••
vcool said:
Everything looks ok. Did you save the file as .php and not .xhtml/.html? Can you point to the file on your server so I can take a look?

Thanks,

vcool

Hi Vcool,

I saved it as index.php and removed my index.html page (I have it saved on my hard drive) so it should show up as the homepage at www.antioxidants.mobi, but it is showing up as a blank page.
 
0
•••
Reece said:
Hi Vcool,

I saved it as index.php and removed my index.html page (I have it saved on my hard drive) so it should show up as the homepage at www.antioxidants.mobi, but it is showing up as a blank page.
Have you confirmed your provider supports php?
 
1
•••
scandiman said:
Have you confirmed your provider supports php?

My host is Godaddy. I'm using their economy package. I thought I could do php but I guess that requires an upgrade to a virtual dedicated server it seems? I can't find a definitive answer on their site.
 
0
•••
You might have a windows account and not a linux one. In that case you may have to use ASP/JSP code.

edit:

I just checked, the godaddy economy account does support PHP, but you might have selected windows account and not linux. PHP works with linux account only.
 
0
•••
vcool said:
You might have a windows account and not a linux one. In that case you may have to use ASP/JSP code.

Oh, thank you Vcool. Yes, I have a Windows account.
 
0
•••
Reece said:
Oh, thank you Vcool. Yes, I have a Windows account.

Ok, In that case choose ASP code and copy paste and save file as .asp and try. Hope this helps.
 
0
•••
vcool said:
Ok, In that case choose ASP code and copy paste and save file as .asp and try. Hope this helps.

Hi Vcool,

I have the code like this now:

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="max-age=3000" />
<title>
Antioxidants.mobi
</title>
<meta http-equiv="Content-Style-Type" content="text/css; charset=charset=UTF-8" />
<meta name="keywords" content="antioxidants, health, nutrition, vitamins, supplements, resveratrol, melatonin, quercetin" />
<meta name="description" content="Antioxidant information you can trust" />
<style type="text/css">A:link {color:white;}
A:visited {color:white;}

body {background-color: #330099}

</style>

<style type="text/css">


p
{
border-bottom: medium solid #FFFFFF
}


</style>
</head>
<body>
<div>
<%
' editable area
' change mob_mode from "test" to "live" when you are done testing
Dim mob_mode
mob_mode="test"
' use this to set a default link to appear if AdMob does not return an ad
Dim mob_alternate_link
mob_alternate_link= ""
' end editable area

' User agent and IP: used for ad targeting
Dim mob_ua
mob_ua= Server.URLEncode(Request.ServerVariables("HTTP_USER_AGENT"))
Dim mob_ip
mob_ip = Server.URLEncode(Request.ServerVariables("REMOTE_ADDR"))

Dim mob_m
mob_m = ""
if mob_mode = "test" then
mob_m = "&m"
end if

Dim mob_url
mob_url = "http://ads.admob.com/ad_source.php?s=a14632421c5256a&u=" & mob_ua & "&i=" & mob_ip & mob_m

Response.Buffer = True
Dim objXMLHTTP, xml
Dim mob_content
' Create an xmlhttp object:
'Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Or, for version 3.0 of XMLHTTP, use:
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

' Opens the connection to the remote server.
xml.Open "GET", mob_url, False

' Actually Sends the request and returns the data:
xml.Send

'Display the HTML both as HTML and as text
'Response.Write "<h1>The HTML text</h1><xmp>"
'Response.Write xml.responseText
mob_content=xml.responseText
'Response.Write "</xmp><p><hr><p><h1>The HTML Output</h1>"

Set xml = Nothing

' parse result
Dim mob_ad_text
mob_ad_text= ""
Dim mob_ad_link
mob_ad_link = ""
Dim pos
pos = Instr(mob_content, "><")

if pos > 0 then
mob_ad_text = Left(mob_content, pos - 1)
mob_ad_link = Mid(mob_content, pos + 2)
end if

if Len(mob_ad_link) > 0 then
' display AdMob Ad
Response.write ("<a href='" & mob_ad_link & "'>" & mob_ad_text & "</a>")
else
' no AdMob ad, display alternate
Response.write (mob_alternate_link)
end if

%>

<a href="http://www.antioxidants.mobi/fruits.html">Fruits</a><br /><br />

<p><span style="color: yellow;">ยฉ 2007 Antioxidants.mobi</span></p>
<a href="http://www.antioxidants.mobi/disclaimer.html">Disclaimer</a>
</div>
</body>
</html>

I just copied it like before, is that right? I saved it as index.asp. When I open my www.antioxidants.mobi page, it shows up as if I hadn't put the code in.

My apologies for how long this is taking...
 
0
•••
If you referash you pages couple of times you can see "Admob Test Ad" displayed. After your test you can change 'mob_mode="test" ' from your code to mob_mode="live" and you should be able to see the ads whenever admob starts serving.

Btw, I just found out that Admob ads are not running on my site as well right now. So, maybe try sometime later, it should work.
 
Last edited:
0
•••
vcool said:
If you referash you pages couple of times you can see "Admob Test Ad" displayed. After your test you can change 'mob_mode="test" ' from your code to mob_mode="live" and you should be able to see the ads whenever admob starts serving.

Is it normal for it to occasionally say: Warning: mysql_pconnect() [function.mysql-pconnect]: Too many connections in /var/www/www.admob.com/inc/db.inc on line 23?

Everything else looks perfect.
 
0
•••
Reece said:
Is it normal for it to occasionally say: Warning: mysql_pconnect() [function.mysql-pconnect]: Too many connections in /var/www/www.admob.com/inc/db.inc on line 23?

Everything else looks perfect.

There is some problem with admob right now. I am also seeing same error message on my site as well.
 
1
•••
vcool said:
There is some problem with admob right now. I am also seeing same error message on my site as well.

Okay, good to know. Thank you very much Vcool for all your help, sending NP and rep your way :)
 
0
•••
vcool said:
There is some problem with admob right now. I am also seeing same error message on my site as well.
The problem is intermittent, keep checking it.
 
0
•••
Reece said:
Okay, good to know. Thank you very much Vcool for all your help, sending NP and rep your way :)


You are welcome. Thanks for the NP and rep.

Regards,

vcool
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back