Solved

Perl script / Curl

Posted on 2009-05-12
8
646 Views
Last Modified: 2013-12-16
I need a Perl script or curl command that searches google.com for a given string...been thru all kinds of documentation on curl and coming up with nothing...can anyone help?
0
Comment
Question by:ifeatu
  • 4
  • 3
8 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 24370762
When you say you want to search google.com for a given string, do you mean you want to perform a Google search or search for a string on the google page?
0
 

Author Comment

by:ifeatu
ID: 24370847
yes.  I want to run a google search and show only the top 5 results.
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 250 total points
ID: 24371497
You can get the results from google using a URL like so:
    http://www.google.com/#q=string
replace "string" with whatever you want to search.

You can use WWW::Mechanize to get the page...
use WWW::Mechanize;
 

my $mech = WWW::Mechanize->new();

$mech->get('http://www.google.com/#q=string');

Open in new window

0
 

Author Closing Comment

by:ifeatu
ID: 31580807
Thanks...worthy of the title Genius!
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:ifeatu
ID: 24380703
Hey...I tried using that Perl Module I tried using the get and the 'put' feature, but for some reason I cannot procure the output...here is my code using the 'put' command...the output is absolutely nothing.
use WWW::Mechanize;
 

my $mech = WWW::Mechanize->new();

$mech->put('http://www.google.com/#q=string', 'test' => $tempfile );

print $tempfile;

Open in new window

0
 
LVL 39

Expert Comment

by:Adam314
ID: 24398481
Did you get it figured out?  If $tempfile is the name of a file, you can not upload it like that.
0
 

Author Comment

by:ifeatu
ID: 24414714
No i didn't :-( Still need help I'm a n00b.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 24423135
What are you trying to do?  To get the contents from the google page, you can use:
use WWW::Mechanize;

 

my $mech = WWW::Mechanize->new();

$mech->get('http://www.google.com/#q=string');

print $mech->content;

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Have you ever stumbled upon a software that is so great that you just love? It happened to me. Love at first sight. Filezilla Server.   Ok its not the most advanced ftp server I've came across. But its a fairly simple piece of software to get the …
Fine Tune your automatic Updates for Ubuntu / Debian
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now