Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: LWP post

by moxliukas (Curate)
on Jun 18, 2002 at 16:03 UTC ( [id://175405]=note: print w/replies, xml ) Need Help??


in reply to Re: LWP post
in thread LWP post

Yes, this is true. Google does not like these things. However I do have a small script that uses GET method that could be of some use to the person who asked the question. Use it only for learning and as smitz said, have a look at Google API.
use URI; use LWP::UserAgent; my $what_i_want_to_find = 'perl monks'; $ua = LWP::UserAgent->new; # google doesn't like it when user agent is libwww perl, so # I change it to Mozilla/5.0 $ua->agent('Mozilla/5.0'); my $uri = URI::new; $uri->query_form('q'=>$what_i_want_to_find); my $url = 'http://www.google.com/search' . $uri->as_string; my $req = HTTP::Request->new(GET => $url); my $res = $ua->request($req)->as_string; $res =~ /\<p\>\<a href\=([^>]+)\>/; print $1;
I hope this was useful.

Replies are listed 'Best First'.
Re: Re: Re: LWP post
by Anonymous Monk on Jun 18, 2002 at 16:13 UTC
    Thanks moxliukas, I now understand the Get method, Do you know if the Post method works in a similar fashion when trying to automate the submit button on a form?
      I am not sure how POST works, maybe some other PerlMonks could provide this information... I have used HTML::Form for form submission previouly, so have a look at that, it is pretty easy to understand.
      Check out the second bit of sample code in this node to see how to set up a POST request.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://175405]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found