Brom
Gummibärchen
- 13 Januar 2007
- 656
- 69
Hallo,
ich habe folgende Funktion:
Die Funktion kann aber keine https-Verbindung öffnen,
ich bekomme immer nur folgenden Header zurück:
Wie kann ich mit fsockopen über Https die Datei aufrufen ?
Geht das überhaupt ?
Gruß
Brom
ich habe folgende Funktion:
PHP:
function sendToHost($host,$method,$path,$params,$cookies=array(),$useragent=0)
{
// Supply a default method of GET if the one passed was empty
if (empty($method))
$method = 'GET';
$method = strtoupper($method);
$fp = fsockopen($host,80);
$data = '';
foreach ($params as $key => $val) {
$pair = $key.'='.urlencode($val);
if (empty($data))
$data = $pair;
else
$data .= '&'.$pair;
}
if ($method != 'POST')
$path .= '?' . $data;
fputs($fp, "$method $path HTTP/1.0\n");
if (!empty($cookies)) {
fputs($fp, "Cookie: ");
foreach ($cookies as $key => $val) {
$pair = $key.'='.urlencode($val).';';
fputs($fp, $pair);
}
fputs($fp, "\n");
}
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: " . strlen($data) . "\n");
if ($useragent)
fputs($fp, "User-Agent: $useragent\n");
fputs($fp, "Connection: close\n\n");
if ($method == 'POST')
fputs($fp, $data);
$header = '';
$content = '';
$bHead = TRUE;
while (!feof($fp)) {
$buf = fgets($fp);
if ($bHead) {
$header .= $buf;
$buf = trim($buf);
if (empty($buf))
$bHead = FALSE;
}
else
$content .= $buf;
}
fclose($fp);
return array($header, $content);
}
Die Funktion kann aber keine https-Verbindung öffnen,
ich bekomme immer nur folgenden Header zurück:
HTTP/1.0 302 Found Location: https://server/pfad/datei.php Server: IP Connection: close Content-Length: 0
Wie kann ich mit fsockopen über Https die Datei aufrufen ?
Geht das überhaupt ?
Gruß
Brom
OK danke