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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.