Hi,
I have a test script to receive an xml file via http post and it appears to work ok when I use it internally. When I move the script to a web server which can be accessed externally nothing appears to be happening. Anyone any ideas?
<?php
if ( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$inp = fopen("php://input");
$outp = fopen("xmlfile" . date("YmdHis") . ".xml", "w");
while (!feof($inp)) {
$buffer = fread($inp, 8192);
fwrite($outp, $buffer);
}
fclose($inp);
fclose($outp);
echo "<html><head>test response</head><body>OK</body></html>";
}
?>
To post the xml I'm using curl, not sure if this is the problem? and I'm NOT sending to a secure connection(HTTPS):
function httpsPost($Url, $xml_data)
{
//Initialisation
$ch=curl_init();
//Set parameters
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_URL, $Url);
//Return a variable instead of posting it directly
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Activate the POST method
curl_setopt($ch, CURLOPT_POST, 1);
//Request
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
//execute the connexion
$result = curl_exec($ch);
//Close it
curl_close($ch);
return $result;
}