0

I have the code:

$map_url = "https://api.madmimi.com/audience_members.xml?username=xx@xx.org&api_key=xx";

if (($response_xml_data = file_get_contents($map_url))===false){
    echo "Error fetching XML\n";
} else {
   libxml_use_internal_errors(true);
   $data = simplexml_load_string($response_xml_data);
   if (!$data) {
       echo "Error loading XML\n";
       foreach(libxml_get_errors() as $error) {
           echo "\t", $error->message;
       }
   } else {print_r($data);}
}

The print_r gives:

 SimpleXMLElement Object ( [@attributes] => Array ( [count] => 202888     
[total_pages] => 6745 [per_page] => 30 [page]
 => 1 ) 
[member] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => 

How do I optain the value [count] => 202888 using php?

LTech
  • 1,677
  • 5
  • 29
  • 48
  • possible duplicate of [How to get the value of an attribute from XML file in PHP?](http://stackoverflow.com/questions/1256796/how-to-get-the-value-of-an-attribute-from-xml-file-in-php) – har07 May 10 '15 at 09:14
  • brilliant, thank you for you simple answer! – LTech May 10 '15 at 09:19

0 Answers0