posting to an https server
| From: | Jomi Garrucho | Date: | Wed, 14 May 2003 03:49:32 +0000 |
| Subject: | posting to an https server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-147537@lists.php.net to get a copy of this message | ||
im trying to pass and retrieve values using post to an https server,
I am trying to connect using the code below it returns with this error
message.
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
===code===
$Header .= "POST $URI HTTP/1.0\n";
$Header .= "Host: www.somesecurehost.com\n";
$Header .= "User-Agent: 007\n";
$Header .= "Content-Type: application/x-www-form-urlencoded\n";
$Header .= "Content-Length: 13\n\n";
$Header .= "var1=1&var2=2\n";
$socket = @fsockopen( "www.somesecurehost.com", 443, $errno, $errstr, 10);
if($socket){
fputs($socket, $Header);
while (!feof($socket)) {
print fgets ($socket,128);
}
}else{
print "noconn";
}
==end code=