kempis555
Programmer
- Jan 2, 2001
- 77
Reading a different thread here tipped me off to PERL's ability to easilty read the contents out of any web site!
This was a neato fix for my local problem of having some servers in front of the firewall and some behind, and only the HTTP port is available on any of them. (Yeah, the network administrators here are long-eared galoots.)
Anyhoot the idea would be cool for anyone who wants his/her perl to get something from the web:
#this example is accessing a cgi
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
# Create a request
my $req = new HTTP::Request GET => ' $req->content_type('application/x- $req->content('match= # 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) {
$the_goods = $res->content;
else{
print "Couldn't connect to website.";
}
This was a neato fix for my local problem of having some servers in front of the firewall and some behind, and only the HTTP port is available on any of them. (Yeah, the network administrators here are long-eared galoots.)
Anyhoot the idea would be cool for anyone who wants his/her perl to get something from the web:
#this example is accessing a cgi
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
# Create a request
my $req = new HTTP::Request GET => ' $req->content_type('application/x- $req->content('match= # 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) {
$the_goods = $res->content;
else{
print "Couldn't connect to website.";
}