Perl Fax - Retrieve Fax Information with FaxStatus
Use the FaxStatus method to retrieve information about one or more submitted faxes with Perl.
The following Perl fax script demonstrates the FaxStatus method, displaying information for a number of submitted faxes:
#/**************** Settings begin **************/ my $username = ''; # Enter your Interfax username here my $password = ''; # Enter your Interfax password here my $lastTransactionID = '999999999'; my $maxItems = '1'; my $NS = 'http://www.interfax.cc'; #/**************** Settings end ****************/ my $client = SOAP::Lite ->uri($NS) ->on_action( sub { join '/', $NS, $_[1] } ) ->proxy('http://ws.interfax.net/dfs.asmx?WSDL'); my $result = $client ->call(SOAP::Data->name('FaxStatus')->attr({xmlns => $NS}) => SOAP::Data->name('Username')->value($username)->type(''), SOAP::Data->name('Password')->value($password)->type(''), SOAP::Data->name('LastTransactionID')->value($lastTransactionID)->type(''), SOAP::Data->name('MaxItems')->value($maxItems)->type('') ); if ( $result->fault ) { print $result->faultstring . "\n"; } else { if( $result->valueof('//FaxStatusResponse/ResultCode') == 0 ) { my @fax_items = $result->valueof('//FaxStatusResult/*'); print "Displaying information for " . @fax_items . " faxes." . "\n"; for(my $i=0; $i < @fax_items; $i++) { print "Item " . ($i + 1) . "\n"; print " TransactionID=". $fax_items[$i]{'TransactionID'} . "\n"; print " SubmitTime=". $fax_items[$i]{'SubmitTime'} . "\n"; print " PostponeTime=". $fax_items[$i]{'PostponeTime'} . "\n"; print " CompletionTime=". $fax_items[$i]{'CompletionTime'} . "\n"; print " DestinationFax=". $fax_items[$i]{'DestinationFax'} . "\n"; print " RemoteCSID=". $fax_items[$i]{'RemoteCSID'} . "\n" if exists $fax_items[$i]{'RemoteCSID'}; print " PagesSent=". $fax_items[$i]{'PagesSent'} . "\n"; print " Status=". $fax_items[$i]{'Status'} . "\n"; print " Duration=". $fax_items[$i]{'Duration'} . "\n"; print " Subject=". $fax_items[$i]{'Subject'} . "\n" if exists $fax_items[$i]{'Subject'}; print " PagesSubmitted=". $fax_items[$i]{'PagesSubmitted'} . "\n"; } } else { print "Error, return code=" . $result->valueof('//FaxStatusResponse/ResultCode') . "\n"; } }

