PyraX Posted September 29, 2009 Share Posted September 29, 2009 Hello, I am trying to make a php curl script that can login and download csv adsense performance reports that are not accessable through the API (to my knowledge). The part I get stuck on is login into google analytics. Have tried for hours using existing scripts of the net but cant seem to get them to work. Can anyone help or have a script that can do this? Thanks in advance PyraX Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 use this works fine http://www.joycebabu.com/blog/speed-up-google-analytics-using-simple-php-script.html don't need curl use fsockopen Quote Link to comment Share on other sites More sharing options...
PyraX Posted September 29, 2009 Author Share Posted September 29, 2009 Thanks redarrow but that appears to be how to locally host urchin.js not login and download a csv report, please correct me if I am wrong Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 try this pal........ <?php /* "AdSense totals sent via SMS to cellphone" http://www.webmasterworld.com/forum89/5349.htm "Follow your Adsense earnings with an RSS reader" http://curl.askapache.com/libcurl/php/examples/rss-adsense.html "Auto-Login to Google Analytics to impress Clients" http://www.askapache.com/webmaster/login-google-analytics.html */ // Uncomment to only allow from IP 1.1.1.1 // if($_SERVER['REMOTE_ADDR'] !== '1.1.1.1') die(); $username=urlencode('myemail@gmail.com'); $password="mypassword"; $gacookie="./.gacookie"; $postdata="Email=$username&Passwd=$password&GA3T=5AS_gBsvDHI&nui=15&fpui=3&askapache=http://www.askapache.com/" ."&service=adsense&ifr=true&rm=hide&itmpl=true&hl=en_US&alwf=true&continue=https://www.google.com/adsense/report/overview&null=Sign in"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,"https://www.google.com/accounts/ServiceLoginBoxAuth"); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie); curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie); curl_setopt ($ch, CURLOPT_REFERER, 'https://www.google.com/adsense/report/overview'); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt ($ch, CURLOPT_POST, 1); $AskApache_result = curl_exec ($ch); curl_close($ch); echo $AskApache_result; unlink($gacookie); exit; ?> donate! web site info File upload with ASP Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 sorry a class will do it but how to i dont no here alink mate... http://www.askaboutphp.com/tutorials/63/google-analytics-api-class-for-php.html Quote Link to comment Share on other sites More sharing options...
PyraX Posted September 29, 2009 Author Share Posted September 29, 2009 Thanks again, I tried those and they both did not work Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 This is goggle own information on the goggle application it self they own it should work.... http://code.google.com/apis/gdata/clientlogin.html Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 just done some research and guess what i got a good one bro http://www.electrictoolbox.com/google-analytics-api-and-php/ apparently the above used heavily and properly supported buy hundreds off php programmers. Quote Link to comment Share on other sites More sharing options...
PyraX Posted September 29, 2009 Author Share Posted September 29, 2009 Thanks, I have tried that one too lol. The issue I have is that I dont want to login to the api, I need to login to analytics normally then once logged in access a report via a link like: https://www.google.com/analytics/reporting/export?fmt=2&id=5941183&pdr=20090829-20090928&cmp=average&rpt=ExitsReport one that the API does not currently support Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.