I am uploading an xml file to a supplier url. Not the content as a post, but the file itself. Regarding the response from the server, the instructions read as follows.
"For each OrderRequest from a client, the server will reply with a single OrderRequestResponse."
And:
"Once a successful order request is received, it will be placed in the queue to be run. The client shall not wait for this report to be generated – the communication over the HTTP socket will only consist of two messages – an OrderRequest, and an OrderRequestResponse."
It then goes on to say that the response may happen anywhere between 1 and 5 minutes later.
So the question is this - I would like to see the respose and make sure that the order has been accepted correctly, but how do i code for this given that i can't leave my cURL routine open for 5 minutes waiting. Can i tell the cURL request where to send the response within the parameters and then close the curl session and have my location process the response to email me or act on the content of the response.
Here is my upload code so far:
$xml = curl_file_create($thefile);
$data = array('test_file' => $xml);
$url = "www.supplierlocation.co.uk/etc";
$curlSession = curl_init();
curl_setopt ($curlSession, CURLOPT_URL, $url);
curl_setopt ($curlSession, CURLOPT_POST, 1);
curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $data);
$ch_result = curl_exec($curlSession);
curl_close($curlSession);
What, if anything can i add so that the respose ends up somewhere that i can deal with it even after the session is closed.
[Does anybody know where i can find example of php code to respond to the response post my side. It would be an XML file that is received.]
Thanks,