Perl Fax – Get Detailed Fax Information Using FaxQuery

Download the Perl fax code samples.

The FaxQuery method allows you to retrieve information about one or more submitted Perl faxes.

In this Perl fax script, detailed information is retrieved for a number of transmitted faxes.

The FaxQuery method has more flexible querying options than FaxStatus (for more details, see Side-by-side Comparison of Web Service Methods).


#/**************** Settings begin **************/
my $username  = ''; # Enter your Interfax username here
my $password  = ''; # Enter your Interfax password here
my $verb     = "gt";
my $verbData = "1";
my $maxItems = "2";
my $NS = 'http://www.interfax.cc';
#/**************** Settings end ****************/


my $client = SOAP::Lite
    ->uri($NS)
    ->on_action( sub { join '/', $NS, $_[1] } ) 
    ->proxy('https://ws.interfax.net/dfs.asmx?WSDL');
    
my $result = $client
    ->call(SOAP::Data->name('FaxQuery')->attr({xmlns => $NS}) =>
            SOAP::Data->name('Username')->value($username),
            SOAP::Data->name('Password')->value($password),
            SOAP::Data->name('Verb')->value($verb),
            SOAP::Data->name('VerbData')->value($verbData),
            SOAP::Data->name('MaxItems')->value($maxItems)
    );


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

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