项目作者: mapbuh

项目描述 :
ONVIF PHP client
高级语言: PHP
项目地址: git://github.com/mapbuh/onvif-client-php.git
创建时间: 2015-01-12T06:37:12Z
项目社区:https://github.com/mapbuh/onvif-client-php

开源协议:

下载


ONVIF client library classes

ONVIFDevicemgmt

The class uses slightly modified devicemgmt.wsdl where endpoint is defined and the reference to onvif.xsd is fixed.
The endpoint is overwritten with the parameter but it is still needed

example:

  1. include( 'inc/ONVIFDevicemgmt.inc.php' );
  2. ini_set( 'default_socket_timeout', 1800 );
  3. $wsdl = 'http://localhost/WSDL/devicemgmt-mod.wsdl';
  4. $service = 'http://192.168.0.1:888/onvif/device_service';
  5. $username = 'username';
  6. $password = 'password';
  7. $client = new ONVIFDevicemgmt( $wsdl, $service, $username, $password);
  8. try {
  9. $res = $client->get_network_interfaces();
  10. var_dump( $res );
  11. } catch ( Exception $e ) {
  12. print "SOAP error occured\n";
  13. $res = $client->client->__getLastRequest();
  14. print "Last request:\n";
  15. print( $res . "\n" );
  16. $res = $client->client->__getLastResponse();
  17. print "Last response:\n";
  18. print( $res . "\n");
  19. }

ONVIF PTZ client library class

The class uses slightly modified ptz.wsdl where endpoint is defined and the reference to onvif.xsd is fixed.
The endpoint is overwritten with the parameter but it is still needed

  1. include( 'inc/ONVIFPTZ.inc.php' );
  2. ini_set( 'default_socket_timeout', 1800 );
  3. $wsdl = 'http://localhost/WSDL/ptz-mod.wsdl';
  4. $service = 'http://192.168.0.1:888/onvif/device_service';
  5. $username = 'username';
  6. $password = 'password';
  7. $client = new ONVIFPTZ( $wsdl, $service, $username, $password);
  8. try {
  9. $client->response_dump( 'GetServiceCapabilities', $client->get_service_capabilities() );
  10. $client->response_dump( 'GetNodes', $client->get_nodes() );
  11. $client->response_dump( 'GetNode', $client->get_node('ptz0') );
  12. $client->response_dump( 'GetConfigurations', $client->get_configurations() );
  13. $client->response_dump( 'GetConfiguration', $client->get_configuration('ptzconf0') );
  14. $client->response_dump( 'GetConfigurationOptions', $client->get_configuration_options('ptzconf0') );
  15. } catch ( Exception $e ) {
  16. print "SOAP error occured\n";
  17. $res = $client->client->__getLastRequest();
  18. print "Last request:\n";
  19. print( $res . "\n" );
  20. $res = $client->client->__getLastResponse();
  21. print "Last response:\n";
  22. print( $res . "\n");
  23. }

ONVIF Media client library class

The class uses slightly modified media.wsdl where endpoint is defined and
the reference to onvif.xsd is fixed. The endpoint is overwritten with the
parameter but it is still needed

  1. include( 'inc/ONVIFMedia.inc.php' );
  2. ini_set( 'default_socket_timeout', 1800 );
  3. $wsdl = 'http://localhost/WSDL/media-mod.wsdl';
  4. $service = 'http://192.168.0.1:888/onvif/device_service';
  5. $username = 'username';
  6. $password = 'password';
  7. $client = new ONVIFMedia( $wsdl, $service, $username, $password);
  8. try {
  9. $client->response_dump( 'GetProfiles', $client->get_profiles() );
  10. } catch ( Exception $e ) {
  11. print "SOAP error occured\n";
  12. $res = $client->client->__getLastRequest();
  13. print "Last request:\n";
  14. print( $res . "\n" );
  15. $res = $client->client->__getLastResponse();
  16. print "Last response:\n";
  17. print( $res . "\n");
  18. }