output of RSS of forms for reporting statistics of Google Adsense income
This is a simple script, the income forms for reporting statistics that is Google Adsense through interface of Google Adsense API founds RSS output, the RSS that you can like with you reads a tool to examine the income case of Adsense.
Install and use:
1.Duplicate the code below saves the.php file that is an any names.
2.Before modification code a few your Google Adsense users in travel renown, the information such as the password.
3.The Php file after uploading you to revise reachs a secret place of your server (the income situation that prevents others to examine you) , such income that can read a tool to examine Google Adsense with your RSS.
<? Php
/ *
Hack Name: Adsense To RSS
Version: 1
Hack URI: Http://frenchfragfactory.net/ozh. . . Rnings-in-rss-feed/
Description: Follow Your Adsense Earnings With An RSS Reader
Author: Ozh
Author URI: Http://planetOzh.com
*/
/ ************ SCRIPT CONFIGURATION ***********/
/ *********************************************/
$username= “you@email.com” ;
/ / Your Adsense Username
$password= “MySuPeRpAsSwOrD” ;
/ / Your Adsense Password
$daterange = 20;
/ / Range Of Days To Aggregate In RSS Reader
$cookie= ” . / .cookiefile” ;
/ / A Temp File Name - You Mostly Don’t Care About This
/ / This Will Create A Hidden File In The Current Directory. If It Seems To Fail,
/ / Replace With A Full Physical Path (i.e. / Home/you/temp/cookiefile)
/ ************ DO NOT MODIFY BELOW ************/
/ *********************************************/
$daysbefore = Mktime(0, 0, 0, date(”m” ) , date(”d” ) - $daterange, date(”Y” ));List ($d_from, $m_from, $y_from) = Split(’:', date(”j:n: Y”, $daysbefore));List ($d_to, $m_to, $y_to) = Split(’:', date(”j:n: Y”) ) ;
/ * Following Lines Are Based On A Script Found On WMW Forums */
/ * Http://www.webmasterworld.com/forum89/5349.htm */
$destination= “/adsense/report/aggregate? $destination= “/adsense/report/aggregate??
. “SortColumn=0 “
. "&reverseSort=false "
. "&csv=true "
. "&product=afc "
. "&dateRange.simpleDate=today "
. "&dateRange.dateRangeType=custom "
. "&dateRange.customDate.start.day=$d_from "
. "&dateRange.customDate.start.month=$m_from "
. "&dateRange.customDate.start.year=$y_from "
. "&dateRange.customDate.end.day=$d_to "
. "&dateRange.customDate.end.month=$m_to "
. "&dateRange.customDate.end.year=$y_to "
. "&unitPref=page "
. "&reportType=property "
. "&searchField= "
. "&groupByPref=date" ;
$postdata= “destination=” .urlencode($destination) . "&username=" .urlencode($username) . "&password=" .urlencode($password) . "&null=Login" ;
$ch = Curl_init();Curl_setopt ($ch, CURLOPT_URL, “Https://www.google.com/adsense/login.do” );Curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);Curl_setopt ($ch, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)” );Curl_setopt ($ch, CURLOPT_TIMEOUT, 20);Curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);Curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);Curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);Curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);Curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);Curl_setopt ($ch, CURLOPT_POST, 1);
$result = Curl_exec ($ch);Curl_close($ch);
$result=preg_split(”/\n/” , $result);Array_pop($result);Array_pop($result);Array_shift($result);
$result = Array_reverse($result);
Header(’Content-type: Text/xml’);Echo ‘‘;Echo “\n”;
? >
Xmlns:cOntent= “http://purl.org/rss/1.0/modules/content/ “Xmlns:wFw= “http://wellformedweb.org/CommentAPI/ “Xmlns:dC= “http://purl.org/dc/elements/1.1/ “
>Https://www.google.com/adsense/ An RSS Feed Of My Adsense Earnings For The Last<? Php Echo $daterange? >DaysEn
<? Php
$firstday=1;
Foreach ($result As $line) {
$item = Array();
$line = Str_replace(”\x00″ , ” , $line);
$line = Str_replace(’ “‘ , ” , $line);List($day, $pages, $clicks, $ctr, $eCPM, $income) = Preg_split(”/\s/” , $line);
$item[’title’]= “
$item[’guid’] = ‘‘. Md5($username. $day) . ““;
$day = Split(’/’ , $day);
$day = Mktime(0, 0, 0, $day[1] , $day[0] , $day[2]);If ($firstday==1) {
$day = Date(”D, d M Y H:i: S 0000 〃 ) ;
$firstday = 0;
} Else {
$day = Date(”D, d M Y H:i: S 0000 〃 , $day);
}
$item[’pubDate’] =“
$day“;
$item[’category’] = ““;
$item[’description’] = “\$$income ($clicks Clicks On $pages Pages: CTR = $ctr - ECPM = $eCPM)“;
$item[’content’] = “<! [CDATA[
] ] > “;
Print “\n”;Print $item[’title’] . ”\n”;Print $item[’guid’] . ”\n”;Print $item[’pubDate’] . ”\n”;Print $item[’category’] . ”\n”;Print $item[’description’] . ”\n”;Print $item[’content’] . ”\n”;Print “\n”;
}
? >
No comments yet. Be the first to comment this post.