November 9, 2008 by Alex Polski
There is a nice PHP class for the retrieving the data from Google Adsense account like impressions, clicks, ctr, ecpm and earnings - PHP account adsense monitor. But it does not work now, seems Google updated the authorization system for Adsense. I’ve fixed it a bit and now you can use it in your web applications.
A small example:
<?php
include('adsense.php');
$adsense = new AdSense();
if ($adsense->connect('username', 'password'))
{
$data = $adsense->yesterday();
var_dump($data);
}
else
{
die('Could not login to AdSense account!');
}
?>
This code will output something like this:
array(5) {
["impressions"]=>
string(2) "49"
["clicks"]=>
string(1) "0"
["ctr"]=>
string(5) "0.00%"
["ecpm"]=>
string(5) "$0.00"
["earnings"]=>
string(5) "$0.00"
}
You can download the script here.
This entry was posted on Sunday, November 9, 2008 at 2:04 pm and is filed under Adsense.
You can skip to the end and leave a response. Pinging is currently not allowed.
Related posts
« How to develop a good scraper on Perl - Lesson 3
Leave a Reply
Posted on December 5th, 2008 at 3:46 pm
It should be:
if (connect(’username’, ‘password’))
instead of:
connect(’username’, ‘password’))