Forum Moderators: martinibuster

Message Too Old, No Replies

AdSense PHP login script broken with new interface

         

JohnKelly

12:39 am on May 9, 2007 (gmt 0)

10+ Year Member



The forced consolidation of Google logins seems to have rendered the PHP AdSense login script inoperable.

The script was originally written by Amznvibe I think:
[webmasterworld.com...]

Does anyone have a fix?

amznVibe

5:02 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup, they finally broke it completely.

I've tried many, many techniques tonight and there simply is no way to request a forwarding URL through the new login.

If anyone knows a passthough for the login, please let me know.

All I can tell is they designed it with a service destination only (mail, adsense, etc) no more url specific forwarding.

I have to study google checkout some more, they might be hiding something in there that I am not fully aware of.

[edited by: amznVibe at 5:04 am (utc) on May 9, 2007]

JohnKelly

5:05 am on May 9, 2007 (gmt 0)

10+ Year Member



I did find another login screen with a much simpler interface. The URL is way too long to post here, so I used TinyURL:

<removed>

Maybe this will work somehow?

[edited by: jatar_k at 2:46 pm (utc) on June 27, 2007]

amznVibe

5:11 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah that's just the framed login box they now use on all their services.

It's actually why it won't forward.
Well, that and this damn AJAX that everyone seem to insist on using to break everything.

The only way I can think to get around this is to do a much more complex technique of logging in, getting the sessionid, then using that sessionid to make the request. Then the session would have to be closed.

To be honest, while I understand the technique, I've never actually attempted such a complex transaction in curl. It's going to take alot of trial and error.

Of course this also happens when I am particularly busy with other projects.

[edited by: amznVibe at 5:37 am (utc) on May 9, 2007]

incrediBILL

5:43 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The change didn't break SysSense ;)

amznVibe

6:44 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I have it figured out.
A bit messy but it works.

Can someone post their standard original code?
My copy is so hacked up it's not going to be useful as a reference.

Basically you have to do four transactions.

[edited by: amznVibe at 7:06 am (utc) on May 9, 2007]

wheelie34

7:20 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bill, does it still take you to 2 pages though, the first asks IF you are one of the following people, shows account email addy, then you click Return to adsense.

Although it updates itself fine, just when you want to look at the account it takes you around the houses, how do I bypass that screen with SysSense?

amznVibe

7:30 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the new replacement curl core - testing working, at least so far:
Not pretty and needs three fetches, but it works.
Improvements welcome.

[1]
$username="your-username";
$password="your-password";
$postdata="Email=".urlencode($username)."&Passwd=%09".urlencode($password)."&service=adsense&ifr=true&rmShown=1&null=Sign+in";
$agent="User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)";
$cookie=dirname(__FILE__)."/cookiefile";
putenv('TZ=US/Pacific'); $randate=mktime(0, 0, 0, date("m"), date("d")-rand(3,26),date("Y"));
[/1]
[1]
$chain=array(
"https://www.google.com/accounts/ServiceLoginBoxAuth",
"https://www.google.com/accounts/CheckCookie?continue=https%3A%2F%2Fwww.google.com%2Fadsense%2Flogin-box-gaiaauth&followup=https%3A%2F%2Fwww.google.com%2Fadsense%2Flogin-box-gaiaauth&service=adsense&hl=en_US&chtml=LoginDoneHtml",
"https://www.google.com/adsense/report/aggregate?sortColumn=0&reverseSort=false&storedReportId=-1&isOldReport=false&product=afc&dateRange.simpleDate=thismonth&dateRange.dateRangeType=custom&dateRange.customDate.start.month="
.date("n",$randate)."&dateRange.customDate.start.day=".date("j",$randate)."&dateRange.customDate.start.year=".date("Y",$randate)."&dateRange.customDate.end.month=".date("n")."&dateRange.customDate.end.day=".date("j")."&dateRange.customDate.end.year=".date("Y")
."&unitPref=page&reportType=property&searchField=&groupByPref=date&csv=true&outputFormat=TSV_EXCEL"
);
[/1]
[1]
$ch = curl_init();
foreach ($chain as $url)
{
curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_TIMEOUT, 35);
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);
// echo "<html>".$result;
[/1]

[edited by: amznVibe at 8:01 am (utc) on May 9, 2007]

JohnKelly

1:41 pm on May 9, 2007 (gmt 0)

10+ Year Member



Pretty or not, it works! Many, many thanks AmznVibe for figuring this out and posting the fix!

amznVibe

7:02 pm on May 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've always been curious how many people are still using my script after all these years.I suspect the code has been copied to other sites/software but it's not incredibly hard to come up with from scratch, just tedious.

I've got years worth of adsense data in a mysql database, not sure what to do with it all but it's interesting to accumulate.

Has anyone ever figured out how to track clicks in Mozilla browsers? The IE click tracker code still works great but there was never a solution for Firefox, etc.

[edited by: amznVibe at 7:02 pm (utc) on May 16, 2007]