title: Why does Pubmed generate different results from a PHP script than from a manual search?
body: <p>I've written a PHP script that automatically searches the NCBI Pubmed database based on a user input.  It's quite a large script and I won't bother putting it all in here.  But one problem that I can't figure out is why, when I search Pubmed using esearch (one of the eutils) I get a different result if it's done using a PHP script than when it's done manually?</p>
  
  <p>Let me give you an example. You can manually enter this into a browser window: <a href="http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;term=cancer%20AND%20Nature%5Bjour%5D&amp;retmode=xml" rel="nofollow">http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;term=cancer+AND+Nature[jour]&amp;retmode=xml</a></p>
  
  <p>You'll see it generates an XML file where the Count field (the number of hits) is 5986.</p>
  
  <p>But if I use the following PHP script:</p>
  
  <pre><code>&lt;?php
  $test = simplexml_load_file('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;term=cancer+AND+Nature[jour]&amp;retmode=xml');
  echo $test-&gt;Count;
  ?&gt;
  </code></pre>
  
  <p>It returns a value of 0.  This seems to happen whenever a search term is modified to include an additional field, or a non-standard field contains more than one search term.  In this case it's the number of searches that "Cancer" brings up but restricted to publications in the journal "Nature", the second field.   If I modify the search term so that it looks for cancer and DNA ('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;term=cancer+AND+DNA&amp;retmode=xml'), two different search terms within the same field, it works fine in the script.</p>
  
  <p>If I search within a single non-standard field: ('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;term=Nature[jour]&amp;retmode=xml') it works fine - but if I then modify it to include two terms in the journal field ('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;term=Science[jour]+OR+Nature[jour]&amp;retmode=xml') the discrepancy between manual and PHP generated returns.</p>
  
  <p>Does anyone have any idea why this might be happening? </p>
  
  <p>Thanks for any help you could offer.</p>