0

there is my code:

if(isset($_GET['addr'])) {

        $ip = $_GET['addr'];

        $addr = "http://rest.db.ripe.net/abuse-contact/".$ip.".xml";

        $cnt = file_get_contents($addr);

        $simple = simplexml_load_string($cnt);

        //print_r($simple->abuse-contacts->email);
        //print_r ($simple->abuse-contacts['email']);
        //var_dump((string)$simple->abuse-resources);

}

It should get value of email attribute from <abuse-contacts> tag. Gowever, none of commented options work! It returns nothing, 0, int()0, ... Just one big bug. I am sure $simple is loaded correctly, as I var_dumped it already. Please help me and tell what I am doing wrong.

Sample XML file, which I am going to parse:

<abuse-resources xmlns:xlink="http://www.w3.org/1999/xlink" service="abuse-contact">
<link xlink:type="locator" xlink:href="http://rest.db.ripe.net/abuse-contact/31.174.203.126"/>
<parameters>
<primary-key value="31.174.0.0 - 31.174.255.255"/>
</parameters>
<abuse-contacts email="registry@playmobile.pl"/>
<terms-and-conditions xlink:type="locator" xlink:href="http://www.ripe.net/db/support/db-terms-conditions.pdf"/>
</abuse-resources>
TN888
  • 7,659
  • 9
  • 48
  • 84

0 Answers0