ציטוט:
נכתב במקור על ידי MasterNetwork
אני מנסה לקרוא אתר כלשהוא בעל אבטחת SSL ויש לי בעיות בחיבור אליו.
זה השגיאה:
קוד:
HTTP/1.1 400 Bad Request
Date: Mon, 29 Nov 2010 13:32:55 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
וזה חלק מהקוד של הפונקציה לשליחה:
קוד:
$host = 'ssl://www.paypal.com';
$socket = fsockopen($host,443,$errno,$errstr,30);
if ( $socket )
{
$request = "GET {$path} HTTP/1.1\r\n";
$request .= "Host: {$host}\r\n";
$request .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; he; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729)\r\n";
$request .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
$request .= "Accept-Language: he,en-us;q=0.7,en;q=0.3\r\n";
$request .= "Accept-Encoding: gzip,deflate\r\n";
$request .= "Accept-Charset: windows-1255,utf-8;q=0.7,*;q=0.7\r\n";
$request .= "Keep-Alive: 115\r\n";
$request .= "Connection: keep-alive\r\n";
$request .= "Cookie: {$cookies}\r\n";
$request .= "Connection: close\r\n\r\n";
fwrite($socket,$request);
$info="";
while ( !feof($socket) )
{
$info .= fgets($socket,128);
}
return $info;
fclose($socket);
}
|
קוד:
$host = 'ssl://www.paypal.com';
אני לא בטוח אם אפשר להתחבר דרך ssl:// או שחייב https://
אבל בכ"מ, אני גם לא רואה שהגדרת את $path - אתה שולח GET ואז תוכן ריק ולכן מקבל בחזרה Bad Request.