Ncbi blast api data retrieval problem using php
0
0
Entering edit mode
7.8 years ago

I create a program to get the results from the blast using blast rest api. I success fully getting RID. When i passed RID into the url for getting result it show html output and also every 2 seconds page redirecting to the server. Visit this url you will find out my problem peerscientist.net. find out these images also http://prnt.sc/eb3l8q, http://prnt.sc/eb3mcz.

Here is the complete code.

class BlastAPI{

    public function blastdata(){

    $url = "https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Put&QUERY=SSWWAHVEMGPPDPILGVTEAYKRDTNSKK&PROGRAM=blastp&FILTER=L&DATABASE=nr&FORMAT_TYPE=XML";
        $ncontent = $this->rid($url);
        echo '
RID :'.$ncontent.'
'; $geturl = $this->geturl($ncontent); echo $geturl; $fulldata = $this->getfullData($geturl); if($fulldata != ''){ echo '
';
        var_dump($fulldata);
        echo '
'; }else{ echo "Code Once"; } } public function rid($url){ $surl = $url; echo $surl; //header('Content-type: text/html'); $content = file_get_contents($surl); $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->loadHtml($content); libxml_use_internal_errors(false); $data = $doc->getElementById("rid"); $rid = $data->getAttribute('value'); return $rid; } public function geturl($rid){ $srid = $rid; $mainurl = "https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=$srid&FORMAT_OBJECT=SearchInfo"; return $mainurl; } public function getfullData($url){ $murl = $url; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $murl); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $str = curl_exec($curl); curl_close($curl); return $str; } } $nblast = new BlastAPI(); $nblast->blastdata();
php blast api ncbi • 2.1k views
ADD COMMENT
0
Entering edit mode

Have you found an answer to this yet? I'm having the exact same problem in Java.

ADD REPLY

Login before adding your answer.

Traffic: 1520 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6