Reputation: 401
Im trying to export some data from here (XML)
e.g and For example i'm trying to get the by using this code:
$xml = simplexml_load_string($response);
$results = $xml->Iteration[0]->{'Iteration_query-def'};
The thing is that returns the Notice written in post's title.
Am i loosing something in the path of XML file ?
Thank you.
Upvotes: 0
Views: 225
Reputation: 13728
try simplexml_load_file()
to fetch data from url
$xml = simplexml_load_file('http://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=VY1DT6CN014&FORMAT_TYPE=XML');
echo $results = (string)$xml->BlastOutput_iterations->Iteration[0]->{'Iteration_query-def'};
Upvotes: 1
Reputation: 1821
Please notice structure of XML document. There is a parent for Iteration called 'BlastOutput_iterations'. Please try below script.
$results = $xml->BlastOutput_iterations->Iteration[0]->{'Iteration_query-def'};
Upvotes: 1