lightlydone Posted November 25, 2010 Share Posted November 25, 2010 Hi, I submit form data as an xml string - $strXML - using curl: curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, '1'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, array('lead'=>$strXML)); $strResult = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); The xml response is: <result> <posting_error>0</posting_error> <lead>0</lead> <valid>1</valid> <redirect_url>http://www.xxx.com</redirect_url> </result> and I need to redirect the user to <redirect_url>. I am trying the following: $xml = new SimpleXMLElement($strResult); header("Location:" . $xml->result->redirect_url); but with no joy. Could anyone suggest how I can achieve what I want? Thanks. Link to comment https://forums.phpfreaks.com/topic/219828-extract-url-from-xml-response-and-redirect/ Share on other sites More sharing options...
ignace Posted November 25, 2010 Share Posted November 25, 2010 header("Location:" . $xml->result[0]->redirect_url); Link to comment https://forums.phpfreaks.com/topic/219828-extract-url-from-xml-response-and-redirect/#findComment-1139631 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.