1. Go to this page and download the library: Download muammertopcu/php-onvif library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
muammertopcu / php-onvif example snippets
f = new Ponvif();
$result = $onvif->discover();
var_dump($result);
f = new Ponvif();
$onvif->setUsername('admin');
$onvif->setPassword('password');
$onvif->setIPAddress('192.168.1.108');
// In some cases you need to set MediaUrl manually. You can find it in "XAddrs" key (see above).
// $onvif->setMediaUri('http://192.168.1.108:3388/onvif/device_service');
try
{
$onvif->initialize();
$sources = $onvif->getSources();
$profileToken = $sources[0][0]['profiletoken'];
$mediaUri = $onvif->media_GetStreamUri($profileToken);
var_dump($mediaUri);
}
catch(Exception $e)
{
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.