Mam taki problem za pomocą polecenia
pobieram pliki na mój serwer.
Jak sprawdzić przed pobraniem jaki rozmiar ma ten plik, i jaką nazwę

function HTTP_Get_Header( $url ) { $get_timeout = 40; { $s_Complete["host"] = $s_Complete["path"]; $s_Complete["path"] = ''; } $s_Host = $s_Complete["host"]; if( @$s_Complete["path"] == "" ) $s_Complete["path"] = "/?"; $s_URI = $s_Complete["path"]; if( @$s_Complete["query"] != "" ) $s_URI .= '?'.$s_Complete['query']; if( @$s_Complete["port"] != "" ) $s_Port = $s_Complete["port"]; else $s_Port = 80; $request = "GET $s_URI HTTP/1.0\r\n"; $request .= "Accept: */*\r\n"; $request .= "Cache-Control: no-cache\r\n"; $request .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.2) Gecko/2008090514 Firefox/3.0.2\r\n"; $request .= "Host: $s_Host\r\n"; $request .= "Connection: Close\r\n"; $request .= "\r\n"; { $query_timeout = 30; $line = ""; $header = ""; { $header .= $line; if( $diff > $get_timeout ) break; break; } return $header; } return false; }
echo HTTP_Get_Header('http://rs1l3.rapidshare.com/files/407970280/RapidShareManager2WindowsSetup.exe');
HTTP/1.0 302 Found Connection: close X-Powered-By: PHP/5.3.1 Content-type: text/html Content-Length: 0 Date: Thu, 03 Feb 2011 12:35:43 GMT Server: lighttpd/1.4.25
$options[CURLOPT_HEADER] = True; $options[CURLOPT_NOBODY] = True; $c = curl_init($URL); curl_setopt_array($c,$options); $result = curl_exec($c);
HTTP/1.1 400 Bad Request Content-Type: text/html Content-Length: 349 Connection: close Date: Thu, 03 Feb 2011 12:39:50 GMT Server: lighttpd/1.4.25
curl -sI $URL
Array ( [0] => HTTP/1.1 400 Bad Request [1] => Content-Type: text/html [2] => Content-Length: 349 [3] => Connection: close [4] => Date: Thu, 03 Feb 2011 12:46:21 GMT [5] => Server: lighttpd/1.4.25 [6] => ) 0