我有“Shany”ip cammera,它支持“onvif”协议。从相机GUI我发现本地IP,在屏幕上可以看到:
所以通过互联网上的例子,我写了一小段代码,但仍然不起作用......可能有人可以帮我解决这个问题吗?
try {
$header_security = array(
'UsernameToken' => array(
'Username' => 'admin',
'Password' => 'pass123',
'Nonce' => 'LKqI6G/AikKCQrN0zqZFlg==',
'Created' => gmdate('Y-m-d\TH:i:s\Z')
),
);
$headers = array();
$headers[] = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $header_security, TRUE);
$location = 'http://192.168.000.033:8080/onvif/services';
$client = new SoapClient(NULL, array(
'location' => $location,
'uri' => 'urn:xmethods-delayed-quotes',
'soap_version' => SOAP_1_2,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
'encoding' => 'UTF-8',
'trace' => 1
));
$client->__setSoapHeaders($headers);
$result = $client->GetWsdlUrl();
var_dump($result);
} catch (Exception $e) {
die($e);
}
经过一些操作后,我设法找到了正确的ip:port,所以现在我明白了:
SoapFault exception: [Sender] DTD are not supported by SOAP in /var/www/html/onvif/kirill/onvif.php:30
Stack trace:
#0 /var/www/html/onvif.php(30): SoapClient->__call('GetWsdlUrl', Array)
#1 /var/www/html/onvif.php(30): SoapClient->GetWsdlUrl()
#2 {main}