Adsense for Mobile devices
Mobile ads with Adsense is a new service that is currently developed by Google. It allows to deliver ads on cell phones, smart phones or pocket pcs with a low screen size and resolution. Currently it delivers one ad per page. The pages can be written in WAP 1.x, WAP 2.0/xhtml or chtml (for iNode devices).
To display ads, you have to and then setup an ad. The implementation is based on an executed script that can currently be written in PHP (Version 4.3.0 and higher), Perl as CGI-Script (Version 5.8 and above), JSP (Version 1.2 and better) or ASP 3.0 (and above). This is a bit scary, allow Google script access on the web server, but the current code seems to be ok. Investigating the PHP script shows that it only encodes the Google variables in the $GLOBAL array set in the Ad code.
Tipps and tricks
Problem: require of remote script not allowed by webserver
Error message: Warning: require() [function.require]: URL file-access is disabled in the server configuration in file xxx on line yyy
Warning: require(http://pagead2.googlesyndication.com/pagead/show_ads.php) [function.require]: failed to open stream: no suitable wrapper could be found in xxx on line yyy
Fatal error: require() [function.require]: Failed opening required 'http://pagead2.googlesyndication.com/pagead/show_ads.php' (include_path='.:/usr/local/lib/php5') in xxx on line yyy
Background: the PHP security settings allow_url_fopen and allow_url_include have to be enabled. Google describes this in the FAQ here. If only allow_url_fopen is enabled on the webserver (and so include/require of a remote file disabled), you can use the following code:
eval(str_replace(array(''), '', file_get_contents ('http://pagead2.googlesyndication.com/pagead/show_ads.php'))); instead of
require('http://pagead2.googlesyndication.com/pagead/show_ads.php');. Problem: HTTP 400 error when asking Google for ads
Error message: Warning: fopen(http://pagead2.googlesyndication.com/pagead/ads?&ad_type=text&channel=&client=ca-mb-pub-xxx&format=mobile_single&https=&host=http%3A%2F%2Fwww.yyy.com&ip=91.89.160.26&markup=xhtml&output=xhtml&ref=&url=http%3A%2F%2Fwww.yyy.com&useragent=Mozilla%2F5.0&dt=1.9) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in http://pagead2.googlesyndication.com/pagead/show_ads.php on line 61
Background: it seems a common problem currently seen by many users. ( see thread about the 400 error of Google Adsense for mobile devices ).
It seems as the problem is a Google problem, since it is on the server script that should deliver the ads. No solution is known at the moment. Keep watching the Google group to see a solution. It should hopefully work soon again.
Update: Accessing the page with a browser on a mobile device does NOT result in this error message. So this seems only related to the PC browser. If you encounter this problem, access your website with a mobile browser and it will work. If not, drop a message in the Adsense Google group.
Update (2007-11-04): The problem seems to be solved. It is now possible to view mobile ads with normal browser and computer again, no error message will appear.

