Klaus: HTTPS-Download von fremder Seite

Beitrag lesen

Hi,

Wenn ich allerdings vom Default HTTP/1.1 auf HTTP/1.0 umstelle, dann kommt zwar noch ein Status 200 OK zurück, allerdings keine Daten mehr - vielleicht ist das ja bei deinem Versuch das Problem?

Das scheint das momentane Problem zu sein, denn mit meinem momentanen Script bekomme ich auch keine Fehlermeldung aber auch keine Daten mehr zurück.

Jetzt muss ich mal schauen, wie ich sicherstellen kann, dass HTTP/1.1 verwendet wird.

Hier mal mein derzeitiges Script:

  
function open_https_url($url,$refer = "",$usecookie = false) {  
    if ($usecookie) {  
        if (file_exists($usecookie)) {  
            if (!is_writable($usecookie)) {  
                return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows.";  
            }  
        } else {  
            $usecookie = "cookie.txt";  
            if (!is_writable($usecookie)) {  
                return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows.";  
            }  
        }  
    }  
    $ch = curl_init();  
    curl_setopt($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);  
    curl_setopt($ch, CURLOPT_HEADER, 1);  
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");  
    if ($usecookie) {  
        curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie);  
        curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie);  
    }  
    if ($refer != "") {  
        curl_setopt($ch, CURLOPT_REFERER, $refer );  
    }  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);  
   $result =curl_exec ($ch);  
   curl_close ($ch);  
   return $result;  
}  
  
  
$datei = open_https_url("https://www.db-markets.com/portal/mediadownload/DWL/Abrechnungskurse/31032010-fixing.xls","",true);  
echo "-->".$datei."<--";  
  
$destination=fopen("/lokalerserver/test/AAA.xls","w");  
fwrite($destination,$datei);  
fclose($destination);