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

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

2007年10月13日-はてなブックマーク

スポンサード リンク
[PR] 英単語を忘却曲線アプリを使って超効率よく記憶する方法
携帯版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);

 

これは便利ですね。

関連の記事検索:PHP, google, adsense, 携帯
スポンサード リンク

By.KJ : 2007年10月13日 12:10 livedoor Readerで購読 Twitterに投稿

間違いの指摘をしていただける方はメール、あるいはTwitter/FBでお願いします(クリック)