what I am missing here? all I get returned is "Location: 0"
ini_set("user_agent","Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
$url = "http://ebird.org/ws1.1/data/notable/region/recent?rtype=subnational1&r=US-AZ";
$xml = simplexml_load_file($url);
$locname = $xml->response->result->sighting->loc-id;
echo "Location: ".$locname . "<br/>";
the probelem is with the "-" because php think that you want to subtract id
from $xml->response->result->sighting->loc
the solution is to change :
$locname = $xml->response->result->sighting->loc-id;
to
$locname = $xml->result[0]->sighting[0]->{'loc-id'};
it work with me
i hope this help you
note : i delete response
node because it's the root and i choose the first elemet because the file containe many nodes