Gossamer Forum
Home : General : Perl Programming :

I also have another question

Quote Reply
I also have another question
I need to learn LWP so that I can go to an html page and have it look for certain html codes in the source and when it finds it to print what is after it until some other html commands. For example "<a href='www.whatever.com'>" I would want it to get say... the www.whatever.com part how do I do this using one of the LWP Modules? Once I see one or 2 examples I will understans.
Thanks.

Quote Reply
Re: I also have another question In reply to
from your command like type

perldoc LWP

everything you need is right there

Quote Reply
Re: I also have another question In reply to
I am remotely hosted. Could you e-mail me the docs because I have been trying to get them for a while. Just make them like a .txt file or something. But please e-mail me the docs at miketwalker@cfl.rr.com. Thanks.

Quote Reply
Re: I also have another question In reply to
http://search.cpan.org/...0/lib/lwp/lib/LWP.pm

Quote Reply
Re: I also have another question In reply to
Well those don't help me really can someone PLEASE give me some examples? Thanks.

Quote Reply
Re: I also have another question In reply to
Well, this was on the page I linked to:

An Example
This example shows how the user agent, a request and a response are represented in actual perl code:

# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);


# Create a request
my $req = new HTTP::Request POST => 'http://www.perl.com/cgi-bin/BugGlimpse';
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');


# Pass request to the user agent and get a response back
my $res = $ua->request($req);


# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}


That about covers it. You might want to look at the link I gave above again or do a search at www.dogpile.com or www.yahoo.com.

Regards,
Charlie


Quote Reply
Re: I also have another question In reply to
After re-reading your post, I dont think LWP will automagically do what you want it to do. LWP will get the contents of the page but you will have to code the rest yourself. If you do a search you might find some applications out there you can look at for an example. You might want to look at cgi-resources.com as well.

Regards,
Charlie