Ninjakreborn Posted November 9, 2010 Share Posted November 9, 2010 If your working with Yahoo API, or Yahoo Scraping, is there a way to detect the 999 error. I have an App that deals heavily with Yahoo scraping. However, Yahoo after awhile has the 999 error. What I want to do is detect when it returns the error, serialize all the arrays up into a database, and allow the client to try it again later when Yahoo has removed it's blocking restriction (after about an hour). So, what I have thought about is doing a standard detection script. Just to see if the text 999 was found. SO the function that I use to get data from Yahoo, after awhile it returns: Warning: file_get_contents(http://siteexplorer.search.yahoo.com/search?p=http://http://www.seomarketing.com&bwm=i&bwmf=u&bwms=p&fr2=seo-rd-se&b=1501) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 999 Unable to process request at this time -- error 999 in /var/www/vhosts/seomarketing.com/httpdocs/seotools/competitiveanalysis/functions.php on line 86 What I want to do is supress that error (Which I can do with Error Reporting, or the @ symbol. That is easy. What I also want to do is put up a conditional. if (file_get_contents($url) throws a warning) { // Do some database work. } I can't figure out the best way to approach this. Any advice? Quote Link to comment https://forums.phpfreaks.com/topic/218212-yahoo-999-error/ Share on other sites More sharing options...
BlueSkyIS Posted November 9, 2010 Share Posted November 9, 2010 try/catch? http://php.net/manual/en/language.exceptions.php But I would probably use curl to interact 'more directly' with the remote server. Quote Link to comment https://forums.phpfreaks.com/topic/218212-yahoo-999-error/#findComment-1132300 Share on other sites More sharing options...
salathe Posted November 9, 2010 Share Posted November 9, 2010 You'll have to find some way of reading what the response, if any, was. file_get_contents() only returns the body so you'll have to figure out a way of accessing the headers (to determine whether the HTTP status was 999). The PHP manual page for file_get_contents() is a good start. Quote Link to comment https://forums.phpfreaks.com/topic/218212-yahoo-999-error/#findComment-1132302 Share on other sites More sharing options...
Ninjakreborn Posted November 9, 2010 Author Share Posted November 9, 2010 Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/218212-yahoo-999-error/#findComment-1132343 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.