Solved

Perl script / Curl

Posted on 2009-05-12
8
653 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Hello, As I have seen there a lot of requests regarding monitoring and reporting for exchange 2007 / 2010 / 2013 I have decided to post some thoughts together and link to articles that have helped me. Of course a lot of information you can get…
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é.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

830 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