www.webdeveloper.com
Results 1 to 5 of 5

Thread: Help!

  1. #1
    Join Date
    Jun 2003
    Posts
    6

    Help!

    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

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    It worked for me... I just echoed $title at the end of the script, and it gave me "Google"

  3. #3
    Join Date
    Jun 2003
    Posts
    6
    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

  4. #4
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    Is allow_url_fopen set in your INI file?

    Adam

  5. #5
    Join Date
    Jun 2003
    Posts
    6
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles