Funktion fopen funktioniert nicht (Vieleicht fehlendePlugins

Alles, was den Apache betrifft, kann hier besprochen werden.

Funktion fopen funktioniert nicht (Vieleicht fehlendePlugins

Postby Silvester » 27. April 2008 12:48

Hallo,

ich habe ein Linux-System (Kubuntu 8.04 Hardy Heron) und XAMPP heruntergeladen. In einer PHP-Datei will ich eine Dtei aus dem Iternet (http://www.google.de) öffnen. Der Code ist:

Code: Select all
<?php
   $fhandle = fopen( "http://www.google.de", "r");
   
   $html_page = "";
   
   while ( $file_string = fread( $fhandle, 8096 ) )
   {
      $html_page .= $file_string;
   }
   
   fclose($fhandle);
   
   echo $html_page;
?>


Dann kommt immer folgende Fehlermeldung:

Code: Select all
Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/statistiken/test.php on line 2

Warning: fopen(http://www.google.de) [function.fopen]: failed to open stream: Not a directory in /opt/lampp/htdocs/statistiken/test.php on line 2

Warning: fread(): supplied argument is not a valid stream resource in /opt/lampp/htdocs/statistiken/test.php on line 6


Wenn ich auf eine Lokale Datei zugreifen will, funktionert es auch nicht, dor komm eine Ähnlihe Fehlermeldung.

Kann es sein, dass ich etwas ind der Config-Datei (ich meine das Zeug, was mir phpinfo() zurückgibt) von Apache abändern muss oder fehlen mir einfach die Plugins?

Silvester
Silvester
 
Posts: 2
Joined: 27. April 2008 12:40

Postby Xardas der Dunkle » 27. April 2008 13:11

fopen ist immer bei php dabei ;).
Aber du hast folgendes nicht beachtet: http://de3.php.net/manual/en/filesystem ... -url-fopen

Um urls mit fopen zu öffnen muss allow_url_fopen auf true/1/on stehen.

mfG
User avatar
Xardas der Dunkle
 
Posts: 482
Joined: 09. March 2008 19:40
Location: /var/www

Postby Silvester » 27. April 2008 15:14

die Option war schon auf On, es funktionert totzdem nicht. Fehlt vielleicht ein Stram-Wrapper?

Silvester
Silvester
 
Posts: 2
Joined: 27. April 2008 12:40

Postby Wiedmann » 27. April 2008 15:38

getaddrinfo failed

Mit der DNS-Auflösung auf deinem System stimmt was nicht.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to Apache

Who is online

Users browsing this forum: No registered users and 205 guests