I have a big problem. I am making a php script which posts with HTTP 1.1 a XML data on a HTTPS server (java server pages).
I am using this source that I found in PHPBuilder:
function sendToHost($host,$method,$path,$data,$useragent=0)
{
// Supply a default method of GET if the one passed was empty
if (empty($method))
$method = 'GET';
$method = strtoupper($method);
$fp = fsockopen($host,443);
if ($method == 'GET')
$path .= '?' . $data;
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($data) . "\r\n");
fputs($fp, "Referer: https://<<< here is my ISP host ->>>\r\n");
if ($useragent)
fputs($fp, "User-Agent: MSIE\r\n");
fputs($fp, "Connection: close\r\n\n");
if ($method == 'POST')
fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp,128);
echo ("$buf");
fclose($fp);
return $buf;
}
$x=sendToHost('<<<here i place the host>>>>,'POST','<<<here is the URL path>>>.jsp',$data_send,$useragent=0);
After this is started the other server returns this error message:
HTTP/1.1 400 Bad Request Date: Fri, 15 Feb 2002 14:17:10 GMT Server: Apache Connection: close Content-Type: text/html; charset=iso-8859-1
Bad Request
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.
Hint: https://secure-test.bibit.com:443/
Apache/1.3.20 Server at secure-test.bibit.com Port 443
PLEASE HELP ME!!!