PHP читать структуру ATOM + XML

у меня есть Еще ссылка.

Когда я помещаю эту строку в браузер, она показывает XML состав.
Тогда у меня есть PHP файл call.php:

$root = simplexml_load_file('http://api.elsevier.com/content/search/scidir?query=cmm&httpAccept%28application/atom+xml&apiKey=[validApiKey]');
// Saving the whole modified XML to a new filename
$root->asXml('results.xml');

?>
<?php
header( "Content-Type: application/vnd.ms-excel" );
header( "Content-disposition: attachment; filename=spreadsheet.xls" );// put your file name here
$url = 'updated.xml'; // xml file location with file name
if (file_exists($url)) {
$xml = simplexml_load_file($url);

echo 'Title'."\t" . 'Author'."\t" . 'Publisher'."\t" . 'PDF'."\t\n";
foreach($xml->document as $books)
{
echo $books->title."\t" . $books->author."\t" . $books->publisher."\t" . $books->pdf."\n";
}
}

?>

И это дает мне ошибку:

Предупреждение: simplexml_load_file ():
http://api.elsevier.com/content/search/scidir?query=cmm&httpAccept% 28application / атом + XML&apiKey = [validApiKey]: 1:
ошибка синтаксического анализатора: ожидается начальный тег, ‘<‘не найден в D: \ xampp \ htdocs \ call.php в строке 4

Когда я пытаюсь сделать то же самое с другими ссылками, которые дают мне то же самое XML структуры, показанные по другой ссылке, и это создает results.xml файл.

Я не знаю, почему с одной ссылкой у нее нет проблем, а с другой она не работает.
Благодарю.

МОЯ РЕДАКТИРОВАТЬ:
XML показал в браузере:

<search-results><opensearch:totalResults>9616259</opensearch:totalResults><opensearch:startIndex>0</opensearch:startIndex><opensearch:itemsPerPage>25</opensearch:itemsPerPage><opensearch:Query role="request" searchTerms="((cmm) OR (information) OR (of) OR (description) OR (level))" startPage="0"/><link ref="self" href="http://api.elsevier.com/content/search/scidir?start=0&count=25&query=%28%28cmm%29+OR+%28information%29+OR+%28of%29+OR+%28description%29+OR+%28level%29%29&httpAccept(application/xml&apiKey=472d9f703a39bf442e9912860bc91f01" type="application/xml"/><link ref="first" href="http://api.elsevier.com/content/search/scidir?start=0&count=25&query=%28%28cmm%29+OR+%28information%29+OR+%28of%29+OR+%28description%29+OR+%28level%29%29&httpAccept(application/xml&apiKey=472d9f703a39bf442e9912860bc91f01" type="application/xml"/><link ref="next" href="http://api.elsevier.com/content/search/scidir?start=25&count=25&query=%28%28cmm%29+OR+%28information%29+OR+%28of%29+OR+%28description%29+OR+%28level%29%29&httpAccept(application/xml&apiKey=472d9f703a39bf442e9912860bc91f01" type="application/xml"/><link ref="last" href="http://api.elsevier.com/content/search/scidir?start=5975&count=25&query=%28%28cmm%29+OR+%28information%29+OR+%28of%29+OR+%28description%29+OR+%28level%29%29&httpAccept(application/xml&apiKey=472d9f703a39bf442e9912860bc91f01" type="application/xml"/><entry><link ref="self" href="http://api.elsevier.com/content/article/pii/S0025775316306674"/><link ref="scidir" href="http://www.sciencedirect.com/science/article/pii/S0025775316306674"/><dc:identifier>DOI:10.1016/j.medcli.2016.11.027</dc:identifier><eid>1-s2.0-S0025775316306674</eid><prism:url>http://api.elsevier.com/content/article/pii/S0025775316306674</prism:url><dc:title>Importancia del anión GAP ante la falta de información clínica: descripción de un caso clínico de intoxicación oral grave por metanol</dc:title><dc:creator>Ana Isabel, Rodríguez Ruitiña</dc:creator><prism:publicationName>Medicina Clínica</prism:publicationName><prism:issn>00257753</prism:issn><prism:volume>148</prism:volume><prism:issueIdentifier>5</prism:issueIdentifier><prism:coverDate>2017-03-03</prism:coverDate><prism:coverDisplayDate>3 March 2017</prism:coverDisplayDate><prism:startingPage>238</prism:startingPage><prism:endingPage>239</prism:endingPage><prism:doi>10.1016/j.medcli.2016.11.027</prism:doi><openaccess>0</openaccess><openaccessArticle>false</openaccessArticle><openArchiveArticle>false</openArchiveArticle><openaccessUserLicense/><pubType>Carta al Editor</pubType><pii>S0025-7753(16)30667-4</pii><authors><author><given-name>Ana Isabel</given-name><surname>Rodríguez Ruitiña</surname></author><author><given-name>José Gregorio</given-name><surname>Zorrilla Riveiro</surname></author><author><given-name>Dolors</given-name><surname>García Pérez</surname></author></authors><prism:teaser/></entry>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector