应一次生成多个 URL 的生成代码

Generated code that should generate multiple URLs at once

我想创建一个 URL,它从不同的数组中获取输入以生成搜索。我要检索的数据来自 NCBI。您可以在下面找到我编写的代码。但是我无法让它工作;我卡住了。提前谢谢你。

我应该得到这样的结果,但我什么也没得到。 https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=gene&retmode=xml&retmax=10&sort=relevance&term=A20%20AND%20Homo%20sapiens%20%5borgn%5d%20AND%20alive%5bprop%5d

<blink>

</blink>

$eutils = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils"; $db = "gene"; $gene_symbols = array("A20","HBB","ABO");

$species = array("homo sapiens", "Escherichia coli","Saccharomyces cerevisiae")$links = array();

foreach ($gene_symbols as $key => $GS){ 
   $SP = $species[$key];
   $query = "$GS AND $SP [orgn] AND alive";

   $esearch = "$eutils/esearch.fcgi?db=$db&retmode=xml&retmax=10&sort=relevance&term=";

   echo $esearch; 
   $links[] = get($esearch.$query);   }
   foreach($links as $lk){
      xml = simplexml_load_file($lk) or die("feed not loading");    }

   var_dump(xml);
$eutils = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi";

   $databank = "gene";
   $gene_symbols = array("A20","HBB","ABO");

   $species = array("homo sapiens", "Escherichia coli","Saccharomyces cerevisiae");


    foreach($gene_symbols as $value => $GS){
        $Species = $species[$value];


        $esearch = "$GS%AND%alive[prop]%AND+$Species[orgn]";
        $esearch_test = "$eutils?db=$databank&retmode=xml&retmax=10&sort=relevance&term=$esearch";
        $result = file_get_contents($esearch_test);
        echo "Query: " . $esearch_test. "<br \>\n";
        echo "Result: " . $result . "<br \>\n";

        $xml = simplexml_load_string($result);
        echo "Count:<br \>\n";
        echo $xml->Count;
        $C =  $xml->Count;
        echo $C;
    }