I'm accessing the wikipedia api like so: http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=xml&exsentences=2&exlimit=10&exintro=&explaintext=&redirects=&generator=search&gsrsearch=France&gsrlimit=10
This gives me xml, which I'm having trouble accessing. I've tried the following, but I'm getting nothing in return:
ini_set("user_agent", 'myemail');
$xml=simplexml_load_file('http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=xml&exsentences=2&exlimit=10&exintro=&explaintext=&redirects=&generator=search&gsrsearch=France&gsrlimit=10');
header('Content-Type: text/xml');
echo $xml->api->query->pages->page[0]->extract;
Can anyone tell me what I'm doing wrong? Please take into account that I'm an XML newbie here...