Ну, XML можно получить. Что касается действительного, ему не хватает <?xml version="1.0"?>
, но я думаю, что это не требуется.
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="5" yahoo:created="2010-03-09T05:09:03Z" yahoo:lang="en-US" yahoo:updated="2010-03-09T05:09:03Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+*+from+html+where+xpath%3D%22%2F%2Fmeta%22+and+url%3D%22http%3A%2F%2Fwww.cnn.com%22"><results><meta content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org" name="generator"/><meta content="1800;url=?refresh=1" http-equiv="refresh"/><meta content="CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. For in-depth coverage, CNN.com provides special reports, video, audio, photo galleries, and interactive guides." name="Description"/><meta content="CNN, CNN news, CNN.com, CNN TV, news, news online, breaking news, U.S. news, world news, weather, business, CNN Money, sports, politics, law, technology, entertainment, education, travel, health, special reports, autos, developing story, news video, CNN Intl" name="Keywords"/><meta content="text/html; charset=iso-8859-1" http-equiv="content-type"/></results></query><!-- total: 250 -->
Протестировано на моем локальном сервере (PHP 5.3), ошибок нет. Я использовал ваш исходный код, и он работает. Вот print_r ():
SimpleXMLElement Object
(
[results] => SimpleXMLElement Object
(
[meta] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[content] => HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org
[name] => generator
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[content] => 1800;url=?refresh=1
[http-equiv] => refresh
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[content] => CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. For in-depth coverage, CNN.com provides special reports, video, audio, photo galleries, and interactive guides.
[name] => Description
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[content] => CNN, CNN news, CNN.com, CNN TV, news, news online, breaking news, U.S. news, world news, weather, business, CNN Money, sports, politics, law, technology, entertainment, education, travel, health, special reports, autos, developing story, news video, CNN Intl
[name] => Keywords
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[content] => text/html; charset=iso-8859-1
[http-equiv] => content-type
)
)
)
)
)
Я бы предложил вам закодировать URL, но это уже сделано. Вы можете попробовать выполнить запрос с помощью cURL.