0

Is this error due to my IP block or what?

If yes then blocking which IP? on which I have put my script to execute

I am getting this error:

Warning: file_get_contents(http://www.yelp.com/biz/allegro-romano-san-francisco): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /var/www/html/scrap/yelp/simple_html_dom.php on line 75

Is there any way to get rid of this?

Vic Seedoubleyew
  • 9,888
  • 6
  • 55
  • 76
user123
  • 5,269
  • 16
  • 73
  • 121
  • you can have a look at this thread http://stackoverflow.com/questions/4545790/file-get-contents-returns-403-forbidden – user3470953 May 02 '14 at 06:07
  • Works for me with a bogus UA, so it's probably not UA blocking. What is your request data like? Are you making millions of requests to their site? What you need to do is test it on a different machine, or use tor. – Ryan May 02 '14 at 06:07
  • working also for me try $c = file_get_contents('http://www.yelp.com/biz/allegro-romano-san-francisco'); print_r($http_response_header); – Rakesh Sharma May 02 '14 at 06:11
  • wow, had no idea about the `$http_response_header` variable. – Ryan May 02 '14 at 06:15
  • @RPM: yes, made around 3k rwquests – user123 May 02 '14 at 06:17
  • Well, you should chill out on those requests from that single machine, and at least change your IP addressees often. and make sure you send a user agent similar to a browser. Fire up some VM's dynamically after N requests. – Ryan May 02 '14 at 06:18
  • @RPM: can you please elaborate "make sure you send a user agent similar to a browser. " – user123 May 02 '14 at 06:19
  • I used web proxies, they even gives same error – user123 May 02 '14 at 06:19
  • Take a look at the user agent sent via your own browser in the "network" tab when you request stackoverflow.com – Ryan May 02 '14 at 06:19
  • did you mean tools/advance/network tab? there it shows system proxy – user123 May 02 '14 at 06:23

1 Answers1

0

This is not a problem with your script, but with the resource you are requesting. The web server is returning the "forbidden" status code.

Editor
  • 622
  • 1
  • 11
  • 24