Jump to content

[SOLVED] file_get_contents - error - failed to open stream: No such file or directory in


Recommended Posts

Hi,

 

I have ServerA running Solaris. I have a php script that goes out to a page and gets the source code using file_get_contents. However, from this server or any other server it is unable to get the html source code from this server.

 

$source = file_get_contents("https://calendar.cs.sfu.ca");

 

Does not work for some reason. Can anyone please help. Is this ServerA's problem or is there something on the calendar server that has some issues that is preventing me from getting the source? Is there any other way to get the source code for a page in php?

 

This is the error that I get:

 

Warning: file_get_contents(https://calendar.cs.sfu.ca/month.php?year=2007&month=8): failed to open stream: No such file or directory in /PATH/TO/SCRIPT/on/SERVERA on line 17

 

 

 

cheers,

Thusjanthan K.

If allow_url_fopen is false/off, you won't be able to use the http(s):// wrappers.  If it's your server, you can turn it on.  Check phpinfo() or php.ini or ini_get('allow_url_fopen').

 

Cf. http://www.php.net/manual/en/wrappers.php

If allow_url_fopen is false/off, you won't be able to use the http(s):// wrappers.  If it's your server, you can turn it on.  Check phpinfo() or php.ini or ini_get('allow_url_fopen').

 

Cf. http://www.php.net/manual/en/wrappers.php

 

Hi Cf,

 

I have allow_url_fopen on for both servers. allow_url_fopen On On. Any other things that I can try? Which machine do you think is the problem: calendar.cs.sfu.ca or serverA?

 

Thusjanthan

Found the problem. The problem was that ServerA that is calling the calendar.cs.sfu.ca page doesn't have https as one off the registered streams for php. Thus it croaks. So using http instead of https works ;)

 

Cheers,

Thusjanthan Kubendranathan

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.