hab hier die Lösung gefunden:
function getUrl( $url, $proxy="", $proxyport="") {
// build the request {
$urlParts = parse_url($url); // split an URL into protocol, username, password, hostname, port, path, filename, query
$httpReferrer = $urlParts[protocol].$urlParts[host].$urlParts[path];
$username = $urlParts[user];
$password = $urlParts[pass];
$request = "GET ".$url." HTTP/1.1\r\n".
"Accept: */*\r\n".
"Accept-Language: en-us\r\n".
"Connection: Close\r\n".
"Host: ".$urlParts[host]."\r\n".
"User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n".
(($username and $password) ? "Authorization: Basic ".Base64_Encode($username.":".$password)."\r\n" : "").
"Referer: ".$httpReferrer."\r\n".
# "Accept-Encoding: gzip, deflate\r\n".
"\r\n";
// }
// echo "Requeststart: $request Requestende";
$port = ($urlParts[port]) ? ($urlParts[port]) : 80;
if ( $proxy != "" )
{
$urlParts[host] = $proxy;
}
if ( $proxyport != "" )
{
$port = $proxyport;
}
if($fp = FSockOpen($urlParts[host], $port, $errorNumber, $errorMessage, 15)) {
FWrite($fp, $request);
$headers = Array();
// read the headers {
while(!FEOF($fp)) {
$header = Trim(FGetS($fp, 128));
if($header == "")
break;
$headers[] = $header;
}
// }
// read the data {
while(!FEOF($fp))
$data .= FRead($fp, 4096);
// }
FClose($fp);
return $data;
} else {
exit("Verbinungsaufbau unmöglich
");
}
}
[/PHP]