pandaria_5.4.8/doc/Soap_example.php
2021-12-28 12:17:51 +03:00

34 lines
662 B
PHP

<?php
/*
* OCSoap client example
*
* a simple example how to invoke commands using SOAP
*/
$username = 'ADMINISTRATOR';
$password = 'ADMINISTRATOR';
$host = "localhost";
$soapport = 7878;
$command = "server info";
$client = new SoapClient(NULL,
array(
"location" => "http://$host:$soapport/",
"uri" => "urn:Oregon",
"style" => SOAP_RPC,
'login' => $username,
'password' => $password
));
try {
$result = $client->executeCommand(new SoapParam($command, "command"));
echo "Command succeeded! Output:<br />\n";
echo $result;
}
catch (Exception $e)
{
echo "Command failed! Reason:<br />\n";
echo $e->getMessage();
}
?>