我试图从SIDN返回的xml epp消息中提取信息。
但我不是am从这些信息中提取一些变量。我设法得到结果代码和消息。
$domaininfo = xml消息,可以在:http://pastebin.com/HbXMkdD3上看到
$xml = new SimpleXMLElement($domeininfo);
// check result code
if (isset($xml->response->result))
{ foreach($xml->response->result->attributes() as $name => $value) {
if ($name === 'code')
{ $code = $value; }
}
}
if ($code == '1000')
{
$domeinnaamuitxml = $xml->response->{'resData'}->{'domain:infData'}->{'domain:name'};
$techcuitxml = $xml->response->{'resData'}->{'domain:infData'}->{'domain:contact type="tech"'};
$admincuitxml = $xml->response->{'resData'}->{'domain:infData'}->{'domain:contact type="admin"'};
echo "Domein naam : $domeinnaamuitxml \n";
echo "Admin C : $admincuitxml \n";
echo "Tech C : $techcuitxml \n";
}我做错了什么
一旦标签中有:-=或“出现问题,它就会缝合。
所有的帮助都肯定是韦尔库姆
发布于 2014-02-15 14:49:26
使用xpath选择带有simplexml的命名空间元素
$domeinnaamuitxml = (string)$xml->xpath("//domain:name"}[0];注释:由于使用了>= (数组取消引用),上面的代码需要PHPPH5.4。在旧版本的PHP中,请执行以下操作:
$domeinnaamuitxml = $xml->xpath("//domain:name"};
$domeinnaamuitxml = (string)$domeinnaamuitxml[0];看到它的作用:https://eval.in/101915
https://stackoverflow.com/questions/21788253
复制相似问题