Top

HTML responses


Perl Code

Please Register to submit score.
Bookmark and Share
Average Score  6.0 (of 1 scores)
Date Added  Jul 26, 2009
Last Updated  Jul 26, 2009
Tags  agent  browser  html  perl  user 

Description

Good for beginner perl coders for educational purpose. [Comments in snippet are self-explanatory]

Grab the Code

#!/usr/local/bin/perl -w        #turn on warnings
use strict;                     #always use
use LWP::UserAgent;             #used for the request
use HTTP::Request::Common;      #used to build request
 
my ($link,$ua,$req,$results);   #declare variables
 
$link = shift;                  #grab link from standard input
$ua = LWP::UserAgent->new;      #create new user agent
$req = HTTP::Request->new(HEAD => $link);#grab the header   
$results = $ua->request($req)->as_string; #grab the results
print "$results";               #print the header info
 

Comments

  (1)  RSS
Kasbah
Comments: 18
 
Perl Snippet:  HTML responses
Posted Aug 08, 2009
Ohh I never knew that.. interesting but yet so simple lol, nicely done :)

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom