I'm trying to parse a xml response from other server.
I can get my needed objects from that xml. but some times and some how, I cant get some objects. and this error appears.
Fatal error: Call to a member function getElementsByTagName() on a non-object in line 91
I checked every thing and I think there is nothing wrong.
here is an example xml response:
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="http://epp.nic.ir/ns/domain-1.0">
<response xmlns:domain="http://epp.nic.ir/ns/domain-1.0">
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData xmlns:domain="http://epp.nic.ir/ns/domain-1.0">
<domain:infData xmlns:domain="http://epp.nic.ir/ns/domain-1.0">
<domain:name>pooyaos.ir</domain:name>
<domain:roid>305567</domain:roid>
<domain:status s="serverHold"/>
<domain:status s="irnicReserved"/>
<domain:status s="serverRenewProhibited"/>
<domain:status s="serverDeleteProhibited"/>
<domain:status s="irnicRegistrationDocRequired"/>
<domain:contact type="holder">pe59-irnic</domain:contact>
<domain:contact type="admin">pe59-irnic</domain:contact>
.
.
and more...
and I am trying to get this object domain:infData
I think the error is from this part.
when I am trying to get this object, domdocument returns null.
php code:
function DinfData()
{
$data = $this->dom->getElementsByTagName("infData")->item(0);
91: $name = $data->getElementsByTagName("name")->item(0)->nodeValue;
$roid = $data->getElementsByTagName("roid")->item(0)->nodeValue;
$update = $data->getElementsByTagName("upDate")->item(0)->nodeValue;
$crdate = $data->getElementsByTagName("crDate")->item(0)->nodeValue;
$exdate = $data->getElementsByTagName("exDate")->item(0)->nodeValue;
and more...
I marked line 91 in error.
thanks ....
edit
$this->dom
is my DOMDocument object and has no error.
If nothing is wrong is there any better way to get elements?