1
General PHP Help / Re: help on self-updating database
« on: February 21, 2012, 07:23:10 AM »PHP Code: [Select]
require("WebGet.php");
$taxon = $_GET[0];
$agent = new WebGet();
$agent->useCache = true;
$agent->cacheLocation = '';
$agent->cookieFile = 'cookie.txt';
$query = "http://www.uniprot.org/uniprot/?query=organism:$taxon&format=fasta&include=yes";
$file = $taxon . '.fasta';
$agent->requestContent($query);
if($agent->responseStatusCode==200){
$results = $agent->responseHeaders[strtoupper('X-Total-Results')];
$release = $agent->responseHeaders[strtoupper('X-UniProt-Release')];
$date = date("Y-m-d", strtotime($agent->responseHeaders[strtoupper('Last-Modified')]));
print "Downloaded $results entries of UniProt release $release ($date) to file $file\n";
} // 304 Not Modified
elseif($agent->responseStatusCode==304){
print "Data for taxon $taxon is up-to-date.\n";
}else{
die ('Failed, got ' . $agent->responseStatusLine .
" for uniprot/?query=organism:$taxon&format=fasta&include=yes\n");
}i have this file which enables to download all UniProt sequences for a given organism in FASTA format once per release, but still doesn't work... and it has the following error :
Quote
Notice: Undefined offset: 0
Quote
Failed, got for uniprot/?query=organism:&format=fasta&include=yes
can you help me with this?
this the webget class -> https://github.com/shiplu/dxtool/blob/master/WebGet.php
