0

I am trying to scrape some data of this website, it works on my localhost, but when I upload it on server, it gives me this error.

Warning: file_get_contents(http://www.somewebsite.com/page) [function.file-get-contents]: failed to open stream: Permission denied

I have found on my hosting that allow_url_fopen setting is on. I don't know the webpage's extension.

frontendgirl
  • 57
  • 1
  • 13
  • http://stackoverflow.com/a/22829987/3599237 – Akam Jan 23 '16 at 18:48
  • `file_get_contents` is not good way to fetch data from external source. Consider to use [curl](http://php.net/manual/en/book.curl.php) instead. You will have better control over the request. – manRo Jan 23 '16 at 18:52
  • ok, but I need to make this work now, I've uploaded the website for my client and can't change it now – frontendgirl Jan 23 '16 at 18:53
  • Check if you are able to connect to http://www.somesite.com from the server/machine where you run the PHP script. – Jan Rydrych Jan 23 '16 at 19:01
  • it works from my localhost yes – frontendgirl Jan 23 '16 at 19:02
  • Possible duplicate of [PHP ini file\_get\_contents external url](http://stackoverflow.com/questions/3488425/php-ini-file-get-contents-external-url) – Gavriel Jan 23 '16 at 19:07
  • 1
    Please check the value of [allow-url-fopen](http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) in your php setup `php -i | grep allow_url_fopen` – manRo Jan 23 '16 at 19:15
  • @manRo "file_get_contents is not good way to fetch data from external source" *[citation needed]* – PeeHaa Jan 23 '16 at 19:28

0 Answers0