socket problem
Posted: Tue Jun 01, 2004 7:22 am
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);
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);