RE: LWP Help please

2009-05-18 Thread Brian Raven
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
steve silvers
Sent: 17 May 2009 21:10
To: perl-win32-users@listserv.activestate.com
Subject: LWP Help please

 I have looked over the LWP documentation but still have trouble
putting the pieces together. Can someone give 
 me a snippet that shows me how to query google for something, and
display the results. The examples only show  how to match on something
and just print that out. How do I display the results, or format the
results?

Retrieving the results of a google query can be very easy using
LWP::Simple, as you can no doubt see from the documentation.

In order to give a sensible answer to your question How do I display
the results, or format the results? we will need to know what you mean
by that, at least something less vague. As LWP is mainly concerned with
retrieving data, it is unlikely to be involved, as your question seems
to be more related to doing something with the data after retrieving it.

HTH

-- 
Brian Raven 
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: LWP Help please

2009-05-17 Thread Aaron Hawryluk
use LWP::UserAgent;

my $ua = new LWP::UserAgent;
my $url = http://www.google.ca/search?q=perl+lwp+tutorial;;
my $response = $ua-get($url);
if($response-content_type ne text/html){
die(Recieved content-type .$response-content_type., was
looking for text/html.)
}
my $content = $response-content; # $content now holds the html page
from google.
print $content;

OR:

use LWP::Simple;

my $url = http://www.google.ca/search?q=perl+lwp+tutorial;;
my $content = get($url);
die Couldn't get $url. unless defined $content;
# $content now contains the html page from google.
print $content;

On Sun, May 17, 2009 at 2:10 PM, steve silvers stevesilv...@hotmail.com wrote:

 I have looked over the LWP documentation but still have trouble putting the
 pieces together. Can someone give me a snippet that shows me how to query
 google for something, and display the results. The examples only show how
 to match on something and just print that out. How do I display the results,
 or format the results?

 Thanks in advance.

 
 HotmailĀ® goes with you. Get it on your BlackBerry or iPhone.
 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs