<?php
/*
* gatewayav - an anti-virus web service.
* Copyright (C) 2007, 2008 Vermont Department of Taxes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contributor(s):
* Tom Cort <hide@address.com>
*/
require_once('../src/lib/nusoap/nusoap.php');
if ($argc != 2) {
echo "Usage:\n\t" . $argv[0] . " [filename]\n";
exit;
}
if (!file_exists($argv[1])) {
echo "File " . $argv[1] . " does not exist!";
exit;
}
$filename = $argv[1];
$fp = fopen($filename, "r");
$filedata = fread($fp, filesize($filename));
fclose($fp);
$username = "guest";
$password = "secret";
$soapurl = "http://localhost/gatewayav/VirusCheck.php";
$soapaction = "http://gatewayav.sourceforge.net/VirusCheck";
$soapclient = new nusoap_client($soapurl);
$soapmsg = $soapclient->serializeEnvelope('
<VirusCheckRequest xmlns="http://gatewayav.sourceforge.net/VirusCheck">
<Security>
<Username>' . htmlspecialchars($username) . '</Username>
<Password>' . htmlspecialchars($password) . '</Password>
</Security>
<File name="' . htmlspecialchars($filename) . '">' . base64_encode($filedata) . '</File>
</VirusCheckRequest>
','',array(),'document', 'literal');
$result = $soapclient->send($soapmsg, $soapaction);
if ($soapclient->fault) {
print_r($result);
} else {
echo $soapclient->request . "\n";
echo "---\n";
echo $soapclient->response . "\n";
}
?>