Perl Fax – Get List of Inbound Faxes

Download the Perl fax code samples.

The Perl fax script below displays information for a number of submitted faxes using the GetList method.

The GetList method, demonstrated in the following Perl fax example, allows you to retrieve a list of inbound (received) faxes:


#/**************** Settings begin **************/
my $username  = ''; # Enter your Interfax username here
my $password  = ''; # Enter your Interfax password here
my $listType = "AllMessages";
my $maxItems = 10;
my $NS = 'https://www.interfax.net';
#/**************** Settings end ****************/


my $client = SOAP::Lite
    ->uri($NS)
    ->on_action( sub { join '/', $NS, $_[1] } ) 
    ->proxy('https://ws.interfax.net/inbound.asmx?wsdl');
    
my $result = $client
    ->call(SOAP::Data->name('GetList')->attr({xmlns => $NS}) =>
            SOAP::Data->name('Username')->value($username)->type(''),
            SOAP::Data->name('Password')->value($password)->type(''),
            SOAP::Data->name('LType')->value($listType)->type(''),
            SOAP::Data->name('MaxItems')->value($maxItems)->type('')
    );


if ( $result->fault ) {
    print $result->faultstring . "\n";
} else {
    if( $result->valueof('//GetListResult') == 0 ) {
        my @fax_items = $result->valueof('//objMessageItem/*');

        print "Displaying information for " . @fax_items . " faxes." . "\n";
        for(my $i=0; $i valueof('//GetListResult') . "\n";
    }
}