views:

119

answers:

1

I am trying to make a geocode request against the local.yahooapis.com geocode interface. This was working yesterday, with the same AppID, and a hardcoded address. Now I have broken up the query string and programmatically filled it from a database. the api returns a 403 - Forbidden error. I'm not sure if I have hit some throttling restrictions, or messed up my request in refactoring.

Request, with "MY_APP_ID" subbed out:

Warning: file_get_contents(http://local.yahooapis.com/MapsService/V1/geocode?appid=MY_APP_ID&street=6727+N+5TH+ST&city=PHILADELPHIA&state=PA&output=php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden 

And the wireshark of the entire back and forth:

GET /MapsService/V1/geocode?appid=MY_APP_ID&street=BOX+269&city=TOUGHKENAMON&state=PA&output=php HTTP/1.0

Host: local.yahooapis.com



HTTP/1.1 403 Forbidden

Date: Mon, 19 Jul 2010 14:46:42 GMT

P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"

Connection: close

Content-Type: text/html; charset=iso-8859-1



<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
<html><head><title>Yahoo! - 403 Forbidden</title><style>
/* nn4 hide */ 
/*/*/
body {font:small/1.2em arial,helvetica,clean,sans-serif;font:x-small;text-align:center;}table {font-size:inherit;font:x-small;}
html>body {font:83%/1.2em arial,helvetica,clean,sans-serif;}input {font-size:100%;vertical-align:middle;}p, form {margin:0;padding:0;}
p {padding-bottom:6px;margin-bottom:10px;}#doc {width:48.5em;margin:0 auto;border:1px solid #fff;text-align:center;}#ygma {text-align:right;margin-bottom:53px}
#ygma img {float:left;}#ygma div {border-bottom:1px solid #ccc;padding-bottom:8px;margin-left:152px;}#bd {clear:both;text-align:left;width:75%;margin:0 auto 20px;}
h1 {font-size:135%;text-align:center;margin:0 0 15px;}legend {display:none;}fieldset {border:0 solid #fff;padding:.8em 0 .8em 4.5em;}
form {position:relative;background:#eee;margin-bottom:15px;border:1px solid #ccc;border-width:1px 0;}
#s1p {width:15em;margin-right:.1em;}
form span {position:absolute;left:70%;top:.8em;}form a {font:78%/1.2em arial;display:block;padding-left:.8em;white-space:nowrap;background: url(http://us.i1.yimg.com/us.yimg.com/i/s/bullet.gif) no-repeat left center;} 
form .sep {display:none;}.more {text-align:center;}#ft {padding-top:10px;border-top:1px solid #999;}#ft p {text-align:center;font:78% arial;}
/* end nn4 hide */
</style></head>
<body><div id="doc">
<div id="ygma"><a href="http://us.rd.yahoo.com/403/*http://www.yahoo.com"&gt;&lt;img
src=http://us.i1.yimg.com/us.yimg.com/i/yahoo.gif
width=147 height=31 border=0 alt="Yahoo!"></a><div><a
href="http://us.rd.yahoo.com/403/*http://www.yahoo.com"&gt;Yahoo!&lt;/a&gt;
- <a href="http://us.rd.yahoo.com/403/*http://help.yahoo.com"&gt;Help&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
<div id="bd"><h1>Sorry, Forbidden.</h1>
You don't have permission to access this URL on this server.<P>
<P>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
<p>Please check the URL for proper spelling and capitalization. If
you're having trouble locating a destination on Yahoo!, try visiting the
<strong><a
href="http://us.rd.yahoo.com/403/*http://www.yahoo.com"&gt;Yahoo! home
page</a></strong> or look through a list of <strong><a
href="http://us.rd.yahoo.com/403/*http://docs.yahoo.com/docs/family/more/"&gt;Yahoo!'s
online services</a></strong>. Also, you may find what you're looking for
if you try searching below.</p>
<form name="s1" action="http://us.rd.yahoo.com/403/*-http://search.yahoo.com/search"&gt;&lt;fieldset&gt;
<legend><label for

Can you identify what I am doing wrong, or tell me where I can check my AppID for any new restrictions?

Update:

I tried with a brand new appid. I used a 5 second sleep in the script, and only made 3 requests. The very first request failed. No idea what is causing this problem now.

Warning: file_get_contents(http://local.yahooapis.com/MapsService/V1/geocode?appid=orQG_ZLV34EmNvmFaIKpOd5RSu1aBsDEfoxNeJBFhr5VUM5dItKbyXLjoMYi0Q--&amp;street=6727+N+5TH+ST&amp;city=PHILADELPHIA&amp;state=PA&amp;output=php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:\wamp\www\Smartphone\updategeo.php on line 23 1 Warning: file_get_contents(http://local.yahooapis.com/MapsService/V1/geocode?appid=orQG_ZLV34EmNvmFaIKpOd5RSu1aBsDEfoxNeJBFhr5VUM5dItKbyXLjoMYi0Q--&amp;street=7400+OXFORD+AVE&amp;city=PHILADELPHIA&amp;state=PA&amp;output=php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:\wamp\www\Smartphone\updategeo.php on line 23 2 Warning: file_get_contents(http://local.yahooapis.com/MapsService/V1/geocode?appid=orQG_ZLV34EmNvmFaIKpOd5RSu1aBsDEfoxNeJBFhr5VUM5dItKbyXLjoMYi0Q--&amp;street=2+W+FOURTH+ST&amp;city=BRIDGEPORT&amp;state=PA&amp;output=php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:\wamp\www\Smartphone\updategeo.php on line 23 3

Edit again: my best guess is that since im working on a dev box, and the appId was generated for a different domain, its rejecting it. How can i determine if that is correct? This doesnt make 100% sense to me though, as this code did work at some point.

+1  A: 

I've seen this too. Happened when I made a change to my app that increased the volume of Yahoo! API calls, and is only happening for requests from my app's server. I suspect you (and I) exceeded the daily volumes permitted and are blacklisted by IP address. I can still make calls from my dev box with the same api key.

I hope we just get whitelisted again after a day.

The Yahoo! dev support forum for this API is at: http://developer.yahoo.net/forum/index.php?showforum=114

Pat James
Started working again for me within 24 hours
Pat James