Einzelnen Beitrag anzeigen
Alt 22.06.2004, 14:56   #9
mqs
Master
 
Registriert seit: 08.05.2001
Alter: 44
Beiträge: 533


mqs eine Nachricht über ICQ schicken
Standard

hab eine funktion gefunden, die das ausführt. also wenn die url vorhanden ist wird eine "1" zurückgeschickt. ich poste die mal her falls sie noch wer braucht:


PHP-Code:
   /*
   * @return boolean
   * @param  string $link
   * @desc  Überprüft die angegeben URL auf Erreichbarkeit (HTTP-Code: 200)
   */
   
function url_validate$link )
   {        
       
$url_parts = @parse_url$link );

       if ( empty( 
$url_parts["host"] ) ) return( false );

       if ( !empty( 
$url_parts["path"] ) )
       {
           
$documentpath $url_parts["path"];
       }
       else
       {
           
$documentpath "/";
       }

       if ( !empty( 
$url_parts["query"] ) )
       {
           
$documentpath .= "?" $url_parts["query"];
       }

       
$host $url_parts["host"];
       
$port $url_parts["port"];
       
// Now (HTTP-)GET $documentpath at $host";

       
if (empty( $port ) ) $port "80";
       
$socket = @fsockopen$host$port$errno$errstr30 );
       if (!
$socket)
       {
           return(
false);
       }
       else
       {
           
fwrite ($socket"HEAD ".$documentpath." HTTP/1.0\r\nHost: $host\r\n\r\n");
           
$http_response fgets$socket22 );
           
           if ( 
ereg("200 OK"$http_response$regs ) )
           {
               return(
true);
               
fclose$socket );
           } else
           {
//                echo "HTTP-Response: $http_response
";
               return(false);
           }
       }
   } 
____________________________________
http://www.schmausen.at
Dein Infoportal für Mittagsmenüs in Klagenfurt
mqs ist offline   Mit Zitat antworten