Help - Search - Members - Calendar
Full Version: file_get_contents() - More Problems
Invision Power Services > Community Forums > Community Web Design and Coding
Michael Boutros
Hello,

I have a script that includes 2 files, and in each of those files file_get_contents() calls a site using HTTP. In the first file, the code is like this:

CODE
$site1_url = "http://some.site.com?exp=0&query=$term&x=30";

$site1_contents = @file_get_contents$site1_url);
[code]

This works fine, no errors are thrown, and everything is as it is supposed to be. In my second file, it's pretty much the same thing:

[code]$site2_url = "http://www.site.com/partner.jsp?q=$term";

$site2_contents = file_get_contents($site2_url);


However, for the second file, I get an error:

CODE
Warning: file_get_contents(http://www.site.com/partner.jsp?q=some+thing) [function.file-get-contents]: failed to open stream: Connection timed out in /home/michael/public_html/path/to/file.php on line 6


Does anyone know what might be causing this, as it really has me baffled.

Thanks,
Michael Boutros
Michael Boutros
Some Progess?:

Using the code for the second file on my local server, Windows XP Home SP2 works fine, no errors or anything, which leads me to think it is something with the server configuration for PHP. This is the information for the server where it doesn't work:

PHP Info - Click here!

This is the PHP info for my local server:

More PHP Info - Click here!

Thanks to anyone who can help original.gif
Zainzz
Are both the websites you're file_getting to same? or these are 2 separate websiteS? connection timing out means probably the website ain't replying probably ^o)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.