?
Solved

Perl Program to search website and get the data

Posted on 2005-05-13
7
Medium Priority
?
193 Views
Last Modified: 2010-03-05
Hi Experts,

  i want to write a perl program to search a website http://www.ncbi.nlm.nih.gov/entrez/query.fcgi for some key words, and i want the program to show maximum 10 results, what will be the best method. Any suggestion/ comments will be highly appreciated. Thanks,

Sudhir
0
Comment
Question by:sud
  • 4
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
Kim Ryan earned 1500 total points
ID: 14000575
there is a module, www-search to handle this. It has many front ends to differnent search engines, even the one you want PubMed (www.ncbi.nlm.nih.gov) !

use WWW::Search;

$query = "lung cancer treatment";
$search = new WWW::Search('PubMed');
$search->native_query(WWW::Search::escape_query($query));
$search->maximum_to_retrieve(10);
while (my $result = $search->next_result())
{
    $url = $result->url; $title = $result->title; $desc = $result->description;
    print <a href=$url>$title<br>$desc<p>\n";
}

0
 

Author Comment

by:sud
ID: 14010580
Hi ,
 i am getting compilation error,
  i think i dont have WWW::Search module how can i get this module. Thanks,

Sudhir
0
 

Author Comment

by:sud
ID: 14014652
hi,
  i have installed the module but it does not give me the output???????

any suggestion,

sudhir
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:Kim Ryan
ID: 14015362
I would test a sample query manually throught the web interface to see that you have a valid seach criteria
0
 

Author Comment

by:sud
ID: 14018821
I did it with WWW::NCBI::Pubmed, as that is more recent, the WWW::PubMed is old version and does not work properly. Thanks for your response. Thanks,

Sudhir
0
 

Author Comment

by:sud
ID: 14020003
i am fine with B. Thanks,

Sudhir
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question