Click to See Complete Forum and Search --> : Help!


Linas
06-15-2003, 06:29 PM
What is wrong with my configuration?

<?php
$file = fopen ("http://www.google.com/", "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("<title>(.*)</title>", $line, $out)) {
$title = $out[1];
break;
}
}
fclose($file);
?>

gives php_hostconnect.

Linas:mad:

pyro
06-15-2003, 06:46 PM
It worked for me... I just echoed $title at the end of the script, and it gave me "Google"

Linas
06-16-2003, 09:30 AM
It didn't go through past opening the file:

Warning: fopen(): php_hostconnect: connect failed in c:\inetpub\wwwroot\ex.php on line 2

Warning: fopen(http://www.google.com/): failed to open stream: Bad file descriptor in c:\inetpub\wwwroot\ex.php on line 2

Unable to open remote file.

I suppose it should be something wrong with configuration.

Thanks for help. Linas :mad:

AdamGundry
06-17-2003, 07:11 AM
Is allow_url_fopen (http://www.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen) set in your INI file?

Adam

Linas
06-17-2003, 10:09 AM
This is the first thing I did - allow_url_fopen = On in c:\windows\php.ini file - this is XP pro. I even installed Apache server (phpdev423). I also tried this on Win2K with IIS 5. No effect.

On phpdev forum I have found exactly the same error from Joris Van Droogenbroeck (van.droogenbroeck.joris@pandora.be)
Date: 06/22/01.

By the way, http://localhost/ doesn't work while http://127.0.0.1/ does.

Linas:confused: