So I was wondering if it is possible got get a value back as feedback after sending a cURL request. I got a project going on where I send XML data to a Press office, where they check if the data is valid and the press process can begin. Now I need some feedback. I know I can get a message back when i do -
echo 'not enough paper'
or echo 'we can start'
on that page (I mean if they do). But I need a value to like true or false, so I can set a status on my side. I will keep googling and just leave this question here, maybe some one got an idea.
If you are sending some data to an external service or URL, only they can decide to put a status message in the response.
I assume you are getting an HTTP 200 code which indicates that the request was successful, but what the other side does with the request is totally up to them. You might have to request that they add some additional parameters to their response.
Depending on what you ask them to do, you would parse their response that you get when you execute the cURL command -
$retValue = curl_exec($request);
// if they return XML data
$retXML = new SimpleXMLElement($retValue);
// if they return JSON data
$retJSON = json_decode($retValue);
You should use what ever method you feel more comfortable with. If you are already dealing with XML data within your code, then just request that they return some XML data with a status message.
Example return data -
<response>
<status value="true" />
<message value="We can start!" />
</response>
{ 'status':'false','message':'not enough paper!' }