RE: [PHP] posting to an https server

From: Date: Wed, 14 May 2003 17:49:54 +0000
Subject: RE: [PHP] posting to an https server
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147625@lists.php.net to get a copy of this message
Read the manual page on fsockopen. You need PHP 4.3.0 compiled with SSL support to communicate with a secure server. Or you can try using cURL. > -----Original Message----- > From: Jomi Garrucho [mailto:jomi@mindgate.net] > Sent: Tuesday, May 13, 2003 8:50 PM > To: Php (E-mail) > Subject: [PHP] posting to an https server > > > 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=

« previous php.general (#147625) next »