#!/usr/bin/perl
package RVL::Net;
##LICENSE##
use strict;
use warnings;
use LWP::UserAgent;
use Class::Std::Utils;
{
sub getContentByUrl {
my ($url) = shift;
my ($obj) = LWP::UserAgent->new;
$obj->agent('Perl - Get Content');
$obj->timeout(10);
$obj->env_proxy;
my ($response) = $obj->get($url);
return ($response->is_success) ? $response->decoded_content : $response->status_line;
}
sub isProtocol {
my ($url) = shift;
return ($url =~ /^(?:(http(?:s?)|ftp)(?:\:\/\/))/) ? 1 : 0;
}
}
1;
=pod
=head1 RVL::Net
RVL Lib Net.
=head1 HOW IT WORKS
=head2 getContentByUrl($url)
@param String $url - URL
@return String - Content
simple: getContentByUrl("http://rvskin.com");
status line
404 Not Found
400 URL missing
400 URL must be absolute
406 Not Acceptable
=head2 isGoogleSafeBrowsing($url, key)
@param String $url - URL
@param String $key - Key api google save browsing
@return Boolean - TRUE if url malware
- FALSE if url not malware
simple: isGoogleSafeBrowsing("http://www.americanbanker.org", "ABQIAAAACbhb2dHt9wOFc9WAZ449yhRA--uKSOcch_P986Df-E_rv9aJJw");
reference: http://code.google.com/intl/th-TH/apis/safebrowsing/key_signup.html
=head2 isProtocol($url)
@param String $url - URL
@return Boolean - TRUE if protocol
- FALSE if not protocol
simple: isProtocol("http://rvskin.com");
reference: http://regexlib.com/REDetails.aspx?regexp_id=628
=cut
Copyright 2K16 - 2K18 Indonesian Hacker Rulez