Has there been an update to this code? It no longer works and I would love this functionality to set up Icinga / Nagios alerts to allow me to know when my clients are running low on funds.
On Tuesday, June 12, 2012 4:49:22 AM UTC-4, Freddie Leeman wrote: > > I've created a php/curl script to retreive the prepaid balance of and > Google Adwords account. It's a shame this isn't available in the API. > > <?php >> >> // >> -------------------------------------------------------------------------- >> // FUNCTION TO RETREIVE ADWORDS PREPAID BALANCE USING CURL by Freddie >> Leeman >> // >> -------------------------------------------------------------------------- >> >> $USERNAME = ""; >> $PASSWORD = ""; >> $COOKIE = "/tmp/adwords.cookie"; >> >> // >> ------------------------------------------------------------------------- >> // DO NOT CHANGE ANYTHING BELOW THIS LINE >> // >> ------------------------------------------------------------------------- >> >> $cookiehandle = fopen($COOKIE, 'w'); >> fclose($cookiehandle); >> >> $ch = curl_init(); >> curl_setopt($ch, CURLOPT_URL, 'https://adwords.google.com'); >> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); >> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); >> curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE); >> $loginpage = curl_exec ($ch); >> >> $startpos = strpos($loginpage,"name=\"GALX\"")+11; >> $startpos = strpos($loginpage, "\"", $startpos)+1; >> $stoppos = strpos($loginpage, "\"", $startpos); >> $GALXvalue = substr($loginpage,$startpos,$stoppos-$startpos); >> >> $postData = "continue=https://adwords.google.com/um/gaiaauth"; >> $postData .= "&Email=" . $USERNAME; >> $postData .= "&Passwd=" . $PASSWORD; >> $postData .= "&GALX=" . $GALXvalue; >> >> curl_setopt($ch, CURLOPT_URL, ' >> https://accounts.google.com/ServiceLoginAuth'); >> curl_setopt ($ch, CURLOPT_POST, 1); >> curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData); >> curl_exec ($ch); >> curl_setopt($ch, CURLOPT_URL, ' >> https://adwords.google.com/select/MakePayments?hl=en'); >> $content = curl_exec ($ch); >> curl_close ($ch); >> unlink($COOKIE); >> >> $startpos = strpos($content,"€ ")+12; >> $stoppos = strpos($content, "</td>", $startpos); >> $balance = substr($content,$startpos,$stoppos-$startpos); >> >> $balance = >> floatval(str_replace(",",".",str_replace(".","",$balance))); >> >> echo $balance; >> >> ?> >> > > Op donderdag 19 mei 2011 15:10:10 UTC+2 schreef Marcelo Diegues het > volgende: >> >> How can I show the customer balance using google adwords api? >> >> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.