Hello,
für die Abfrage, ob hinter der URL auch eine Ressource steckt, gibt es den HEAD-Request. Wenn der Webserver will, antwortet er darauf mit den Metadaten zur Ressource.
Beispiel:
function head_request($url, $status_only=false, $parsed=true)
{
    ### checks, if an url exists. 
    ### if no scheme is provided, 'http://' will be assumed
    ### if not "$parsed", raw headers shell be returned, 
    ###     otherwise an array shell be produced
    ###
    ### Used own Constants: TIMEOUT_SOCK_OPEN, TIMEOUT_STREAM_READ
    
    $url = trim($url);
    $_url_parts = parse_url($url);
    if (!isset($_url_parts['scheme'])) $url = 'http://' . $url;
    $_url_parts = parse_url($url);
    
#    * scheme - e.g. http
#    * host
#    * port
#    * user
#    * pass
#    * path
#    * query - after the question mark ?
#    * fragment - after the hashmark #
    if (!isset($_url_parts['host'])) return false;
    $fp = @fsockopen($_url_parts['host'], 80, $errno, $errstr, TIMEOUT_SOCK_OPEN);
    if (!$fp) return false;
    stream_set_timeout($fp, TIMEOUT_STREAM_READ);
	
   	$path = '/';
	if (isset($_url_parts['path'])) {$path = $_url_parts['path'];}
	
    $out = "HEAD $path HTTP/1.1\r\n";
    $out .= "Host: " . $_url_parts['host'] . "\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    
    $res = '';
    
    while (!feof($fp)) 
    {
        $res .= fgets($fp, 128);
    }
    
    $_info = stream_get_meta_data($fp);
    fclose($fp);
    if ($_info['timed_out']) return false;
    
    $res = str_replace(array('   ', '  '), ' ', $res);
    $_lines = explode("\r\n", $res);
#       return $_lines;
    
    foreach ($_lines as $key => $value)
    {
        if (strlen($value) == 0) 
        {
            unset($_lines[$key]);
            continue;
        }
        
        $_help[$key] = explode(': ', $value);
        if (!isset($_help[$key][1]))
        {
            $_out['status'] = explode(' ', trim($_help[$key][0]));
        }
        else
        {
            $_out[strtolower($_help[$key][0])] = explode(' ', trim($_help[$key][1]));
        }   
    }
    if (!isset($_out['status'][1])) return false;
    if ($status_only) return $_out['status'][1];
    if (!$parsed) return $res;
    
    return $_out;   
}
Der muss dann ggf. zirkulär durchgeführt werden, solange bis keine Weiterleitungen mehr als Antwort kommen.
Liebe Grüße
Tom S.
-- 
Es gibt nichts Gutes, außer man tut es!
Das Leben selbst ist der Sinn.
  Es gibt nichts Gutes, außer man tut es!
Das Leben selbst ist der Sinn.
 nicht angemeldet
 nicht angemeldet TS
 TS