Forums

CURL Response

esl 12 Jan, 2015
I am using the curl[GH] action to send information to store in a database. I need to get the response value back from the server. Right now I am able to get a response back but I need to be able to just get a value for a certain input.

so when I post its is
curl[GH]
name=name
last=lastname
phone=phone
email=email


Then in the response i recieve either and Error or Success.
When "Success" I see in the debug like this:
[curl_gh] => 
 Success!
 89
100.50

which in the XML
<response>
<status>Success</status>
<lead_id>89</lead_id>
<delivery_id>100.50</delivery_id>
</response>


I need to return "delivery_id" value from "curl_gh"
How would I do that?
esl 14 Jan, 2015
anyway to parse the node from the curl post?
GreyHead 14 Jan, 2015
Hi esl,

The response is in $form->data['curl_gh'] I think, It's probably the XML string so you would need to parse that. This might work in a Custom Code action:
<?php
$response = new SimpleXMLElement($form->data['curl_gh']);
//uncomment the next line to debug
//echo $response->delivery_id;
$form->data['delivery_id'] = $response->delivery_id;
?>

Bob
This topic is locked and no more replies can be posted.