dongwen9051
2016-07-31 08:29
浏览 48

解析CURL XML响应PHP

Please tell me how can i get $String value for key field name="Contact Tags (Raw)" Basically i need something like this:

$XML->result->contact->Group_Tag("Sequences and Tags")->field("Contact Tags (Raw)")

This is result I got

enter image description here

MY PHP CODE:

<?php
$data = <<<STRING
<search>
    <equation>
    <field>E-Mail</field>
    <op>e</op>
    <value>anast@gmail.com</value>
    </equation>
</search>
STRING;

$data = urlencode(urlencode($data));

$appid = "xxxxxxxxxxxxxxxxxx";
$key = "xxxxxxxxxxxxxxxxxx";

$reqType = "search";
$postargs = "appid=".$appid."&key=".$key."&reqType=".$reqType."&data=".$data;
$request = "https://api.moon-ray.com/cdata.php";

$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
curl_setopt ($session, CURLOPT_HEADER, false);
curl_setopt ($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
header("Content-Type: text/xml");
$decoded = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $response);
echo $decoded;
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题