Jump to content

Recommended Posts

I'm having some problems using file_get_contents on my local server.

 

$text= file_get_contents("file.php");

 

works fine as expected but...

 

$text= file_get_contents("file.php?id=1");

 

...throws a warning "Warning: file_get_contents(file.php?id=1) [function.file-get-contents]: failed to open stream: No error". Putting the url in a browser works correctly though.

Obvious it has to do with the get request but...

 

$text= file_get_contents("http://www.google.com/search?hl=en&q=bpatterson&btnG=Google+Search");

 

...works like it should.

 

I tried using the full URL of file.php but then I get failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. . Also, no luck with using the full file path from root.

 

I tried url_encode which gave me failed to open stream: No such file and a 403 error when using the encoded url in a browser. I guess maybe its a server config problem??? but I wouldn't know what to change.

 

Any ideas?

Thanks

 

I tried using the full URL of file.php
Post what you tried. xxxxxx out any sensitive information in the URL, but don't change any of the syntax.

 

Also, does file.php use sessions or cookies to allow access to it?

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.