OK, firstly, I must be missing something, so I apologise for what may turn out to be a newb question...
I have a complicated bit of code that is just not working, so am putting it out here or any pointers. I can't share too much as it is proprietary, so here goes.
I have three tiers: User, server, appliance. The server, and appliance are php enabled, the client is either IE, or Chrome - the behavior is the same.
The user tier sends data from an HTML 5 form to the server, which in turn logs it in a database, and can send to the appliance - all OK here.
Due to the appliance not being https enabled I am trying to set up a trigger/response model. This means sending an abbreviated message, or key (as a GUID), to the appliance, and then the appliance calling back to the server for an XML message for processing. The call back is done using a get_file_contents()
call.
All the parts seem to be working, the server response is retrieving the XML and the client is picking the XML headers correctly - however when the appliance is performing the call, the response is empty.
$result = file_get_contents($DestURL) ;
// If I call the value in $DestURL in a browser address
// box - it all works
// If I echo the $result, it is empty, and then nothing
// executes, except the last line.
if (strlen($result)== 0 ) {
// ==> this is not executing <==
$msg = "Failed to open the <a href='" . htmlspecialchars($DestURL) . "'> URL<a>: " . htmlspecialchars($DestURL);
$result="Error";
}
// ==> this is not executing <<==
if ($result=="Error")
{
/*
* need to send an error message
*/
}
else
{
$result = PrintMessage($my_address, $result
}
// ==> This is executing <==
Echo "all Finished";
?>
Any ideas from anyone greatly appreciated.
The Server Web service reads like this:
<?php
header("Content-type: text/xml");
// a bunch of items getting the data from the database
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
echo $row['message_XML'];
?>