I am trying to fetch search results from pubmed.
$query=(BRCA1[tiab]) OR (Breast cancer 1 gene[tiab])AND (Cancer[tiab])
$esearch = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$query&retmax=10&usehistory=y';
$handle = fopen($esearch, "r");
$rettype = "abstract"; //retreives abstract of the record, rather than full record
$retmode = "xml";
I get this HTTP Access Failure error.
Error:
Warning: fopen(http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=(BRCA1[tiab]) OR (Breast cancer 1 gene[tiab]) AND (Cancer[tiab])&retmax=10&usehistory=y): failed to open stream: HTTP request failed! HTTP/1.1 406 Not Acceptable in /Applications/XAMPP/xamppfiles/htdocs/search.php on line 60
When I directly paste the url, http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=(BRCA1[tiab]) OR (Breast cancer 1 gene[tiab]) AND (Cancer[tiab])&retmax=10&usehistory=y I get search results in the page but not when accessing through the php script.