Maybe its a question answered before but im so noobie in Web Development. Im trying to get a full XML text from this page:
And, I need to do some XPath queries in that code, like "get the ID" and others. For example:
//eSearchResult/IdList/Id/node()
How I can to get the full XML in a php object to request data throught XPath queries?
I used this code before:
<?php
$text = $_REQUEST['text'];
$xmlId = simplexml_load_file('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=gene&term='.$text.'%5bGene%20Name%5d+AND+%22Homo%20sapiens%22%5bOrganism');
$id = $xmlId->IdList[0]->Id;
$xmlGeneralData = simplexml_load_file('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=gene&id='.$id.'&retmode=xml');
$geneName = $xmlGeneralData->DocumentSummarySet->DocumentSummary[0]->Name;
$geneDesc = $xmlGeneralData->DocumentSummarySet->DocumentSummary[0]->Description;
$geneChromosome = $xmlGeneralData->DocumentSummarySet->DocumentSummary[0]->Chromosome;
echo "Id: ".$id."
";
echo "Name: ".$geneName."
";
echo "Description: ".$geneDesc."
";
echo "Chromosome: ".$geneChromosome."
";?>
But, according with the profesor, this code doesn't use Xpath queries and is required that the page use it.
Someone can help me or explain me how to do it?