Thread Website aufruf (11 answers)
Opened by KCobain at 2011-10-03 14:24

KCobain
 2011-10-03 16:40
#152834 #152834
User since
2011-10-03
34 Artikel
BenutzerIn
[default_avatar]
Hotfile.pm
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package Hotfile;
# Perl->Hotfile API
use strict;
use warnings;
use LWP::UserAgent; 

our $HFA_VERSION = 0.1;                                                     # Perlmodul Version
our $HFA_WHO = "Hotfile-PerlAPI/$HFA_VERSION";                              # UserAgent-Name

sub new() {                                         
     my $class = shift;
     return bless {}, $class;
}

sub link_status($){
  my $url     = shift;
  my $browser = new LWP::UserAgent;
  $browser    ->agent($HFA_WHO);
  my $resp    = $browser->get("http://api.hotfile.com/?action=checklinks&links=$url&fields=status");
  my $status  = $resp->decoded_content();
    return $status;
}
1;


test.pl
Code (perl): (dl )
1
2
3
4
5
6
7
8
#!/usr/bin/perl
use strict;
use warnings;
use lib '.';
use Hotfile;
my $a = new Hotfile;
my $b = $a->link_status("http://hotfile.com/dl/131350300/aec8c02/test.txt.html");
print $b;

Last edited: 2011-10-03 16:42:32 +0200 (CEST)

View full thread Website aufruf