前の記事 «:フォルダをモニターしFlickrに自動で画像をアップロードするツール「Flickr Foldr Monitr」
次の記事 »:PHP:PEAR::Net_Serverでサーバデーモンを作る

PHPから携帯版GoogleAdSenseを使うクラスライブラリ

2007年10月13日

スポンサード リンク
携帯版Google AdSenseのPHPコードがきもいので修正してみた - ふわふわな毎日
allow_url_fopen強制っすか!Notice出しまくりっすか!GLOBAL汚染しまくりっすか!みたいな感じなので修正ついでにクラス化してみた。

PHPから携帯版GoogleAdSenseを使うクラスライブラリ。

10/10に携帯版AdSenseが公開されました。
デフォルトのライブラリは使い勝手が悪いそうで、クラスライブラリの形式で配布されています。

次のように簡単に使えるようです。

$google = new GoogleMobileAdSense();

$options = array();
$options['ad_type']='text';
$options['channel']='xxxxxxxx';
$options['client']='xxxxxxxx';
$options['format']='mobile_single';
$options['https']=$google->getServerVar('HTTPS');
$options['host']=$google->getServerVar('HTTP_HOST');
$options['ip']=$google->getServerVar('REMOTE_ADDR');
$options['markup']='xhtml';
$options['oe']='utf8';
$options['output']='xhtml';
$options['ref']=$google->getServerVar('HTTP_REFERER');
$options['url']=$google->getServerVar('HTTP_HOST') . $google->getServerVar('REQUEST_URI');
$options['useragent']=$google->getServerVar('HTTP_USER_AGENT');

$ad = $google->get($options);

 

これは便利ですね。

スポンサード リンク

投稿者 KJ : 2007年10月13日 12:10 | ブックマークに追加する Subscribe with livedoor Reader
間違いの指摘をしていただける方はメールでお願いします


本を執筆しました。