Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Perl script / Curl

Posted on 2009-05-12
8
Medium Priority
?
661 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 1000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Closing Comment

by:ifeatu
ID: 31580807
Thanks...worthy of the title Genius!
0
 

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

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

886 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