I'm using Windows Vista, I have Apache HTTP server 2.2 running and am using PHP 5.2.17.

I’m having a problem remotely running a php script on the web server. I run this script locally below…

$file = fopen ("http://localhost/Epointment/testphp.php", "r");
if (!$file) {
    echo "<p>Unable to open remote file.\n";
while (!feof ($file)) {
    $line = fgets ($file, 1024);
    /* This only works if the title and its tags are on one line */
    if (preg_match ("@\<title\>(.*)\</title\>@i", $line, $out)) {
        $title = $out[1];
		echo "/n".$title."/n";

And after about 30 seconds get back…

PHP Warning: file_get_contents(http://localhost/Epointment/testphp.php): 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 failed to respond.

As this will be used in the real world I can’t really use a Path instead of the URL and I have tested it on a ‘real’ web server (one that’s not on my pc and not localhost) and it works and I have also run the testphp.php script ok directly on the webserver.

Thanks for any help…

6 Years
Discussion Span
Last Post by matleeds

What happens if you put that URL in a browser on that computer?

May tell you what is going on and also check the apache logs for the errors when it tries to get the page.


I've sorted in now..by putting my ip address in instead of localhost. Maybe localhost has been redefined somewhere..but it works thats the main thing.
How do I mark this topic has solved..thats the next issue..or shall I start another thread to resolve that :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.