xml yanıtı url ayıklamak ve yönlendirme

0 Cevap

I'm using curl to post form data in xml string. The xml response is <redirect_url>www.xxxxx.com</redirect_url>. Could anyone help me to extract this url and redirect the user to it? Thanks.

Sorry been away... Thanks for the responses. The code is:

/ / Yeni bir cURL kaynak oluşturmak

$ch = curl_init('http://www.zzz.com/');

/ / Set r uygun seçenekleri

$strXML = "<lead>   <applicant>   <title>".$title."</title>   <fname>".$fname."</fname>   <lname>".$lname."</lname>   <email>".$email."</email>   <dob>".$dob."</dob>   </lead>";

echo $ strXML;

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

echo $strResult;

($ ch) curl_close;

Örnek Yanıt:

<result>
<posting_error>0</posting_error>
<valid_partner>1</valid_partner>
<redirect_url>www.xxx.com</redirect_url>
</result>

0 Cevap