Jump to content

"Permission denied" with file_get_contents()


Jeremysr

Recommended Posts

A couple of weeks ago I searched for something on Google about storing a webpage into a variable and it said to use file_get_contents(). I tried and it worked. I remember it said sometimes websites would block it though, and it showed some code for a workaround. But I ignored that part because just file_get_contents() worked for me.

 

But NOW, I need to use this function again (my program will get the URLs of a bunch of webcomics I want to download.) And now it says "permission denied" for the site I'm accessing. I tried searching Google and couldn't get the site I was at before or anything else that worked. :-\

 

So, can someone here help me with this please?

Link to comment
https://forums.phpfreaks.com/topic/49931-permission-denied-with-file_get_contents/
Share on other sites

Try setting directory permissions to 777 (but note that it'll cause a major security hole).

 

He obviously has no control over these remote sites.

 

You'll want to take a look at the curl extension. I would say your getting denied errors because you are blatantly ripping content. With curl, you can make it look like your an actual browser making a normal request.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.