I am using following code to send request through the socket.The server
is https://secure.example.com. The request get send but response i am getting is encrypted some thing like([] [] [] []). I am not getting problem.
help me.
$book_flight='has some xml data';
$sock = fsockopen("secure.examle.com", 8443, $errno, $errstr);
if (!$sock) die("$errstr ($errno)\n");
fwrite($sock, "POST /example/FltConfirmRequest HTTPS/1.0\r\n");
fwrite($sock, "Host: secure.example.com");
fwrite($sock, "Content-type: text/xml\r\n");
fwrite($sock, "Content-length: " . strlen($book_flight) . "\r\n");
fwrite($sock, "Accept: */*\r\n");
fwrite($sock, "\r\n");
fwrite($sock, $book_flight);
fwrite($sock, "\r\n");
$headers = "";
while ($str = trim(fgets($sock, 4096)))
$headers .= "$str\n";
echo "\n";
$body = "";
while (!feof($sock))
$body .= fgets($sock, 4096);
fclose($sock);
socket problem
Moderator: General Moderators
You always should have some special configuration on your host to support HTTPS interaction. At least you need SSL library, which, of course, may not be installed on target system. So, there is no absolutely portable way. And cURL seems reasonable requirement IMO since it widely used.
Keep in mind, even if you have cURL installed it may either have HTTPS support or not, depending on compile options.
Keep in mind, even if you have cURL installed it may either have HTTPS support or not, depending on compile options.