Last active
August 29, 2015 14:08
-
-
Save paveljurca/0885b2528ed697e344f3 to your computer and use it in GitHub Desktop.
HTTP requests; quick and dirty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use LWP::UserAgent; | |
$req = HTTP::Request->new( | |
'HEAD' => 'http://fis.vse.cz' | |
); | |
$res = LWP::UserAgent->new( | |
agent => 'Googlebot/2.1' | |
)->request($req); | |
print $req->as_string, | |
$res->as_string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use LWP::UserAgent; | |
use HTTP::Request::Common qw(POST); | |
## WHOIS via HTML form | |
$_ = new LWP::UserAgent->request(POST( | |
'http://www.gigaserver.cz/whois/', | |
Content_Type => 'form-data', | |
Content => [ | |
dost_domain => 'jurcapavel', | |
dost_tld => 'cz', | |
volba => 'OVĚŘIT' | |
] | |
))->content; | |
#extract the WHOIS dump \ | |
#from the HTML content | |
s/.*vypis-whois\">//sg; | |
s/[\n\r]+<\/pre>.*/\n/sg; | |
print; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment