When using Zend_Rest to hit Google's geomapping service, I'm getting isError()
== true all the time, regardless of the server's response. Here's some sample
code:
$key = 'my secret API key';$address = '1600 Pennsylvania Ave, Washington, DC
20500';$rest = new Zend_Rest_Client('http://maps.google.com/maps/geo');$result
= $rest->output('xml')->key($key)->q($address)->get();if ($result->isError()) {
Zend_Debug::dump($result->Response->Status);
Zend_Debug::dump($result->Response->Placemark->Point->coordinates);}
And here's the output:
object(SimpleXMLElement)#11 (2) { ["code"] => string(3) "200" ["request"] =>
string(7) "geocode"}
object(SimpleXMLElement)#11 (1) { [0] => string(24) "-77.0363658,38.8976118,0"}
So, it's succeeding and giving me valid coordinates, but isError() always
triggers. Looking at the code for Zend_Rest_Client_Result, it appears that it's
specifically looking for the word "success" in the status branch. Clearly,
Google is not providing this, so the check fails. I'm not familiar enough with
other REST services to know if this "success" string is something that they
should always be providing. I.e., is this a bug in Zend_Rest_Client_Result, or
will I simply have to extend it to deal with this custom case?
Here is the full output of the result FWIW: http://www.pastie.org/724364
_________________________________________________________________
Get gifts for them and cashback for you. Try Bing now.
http://www.bing.com/shopping/search?q=xbox+games&scope=cashback&form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_Shopping_Giftsforthem_cashback_1x1