rockyjvec / onvif Goto Github PK
View Code? Open in Web Editor NEWPHP Onvif library for IP cameras.
PHP Onvif library for IP cameras.
Hello, I try to use inside Laravel project and always return this message.
The camera is a PTZ Hikvision and works fine with PYTHON ONVIF R resource
$o = new \Rockyjvec\Onvif\Onvif("http://".$session->camera->host.":".$session->camera->port."/onvif/device_service", $session->camera->onvif_user, $session->camera->onvif_pass);
print_r($o->media->GetProfiles());
Output
{
"status": "error",
"code": 500,
"time": 1642591673,
"data": {
"line": 61,
"file": "...../vendor/rockyjvec/onvif/src/Rockyjvec/Onvif/Soap/SoapClient.php",
"message": "The action requested requires authorization and the sender is not authorized",
"type": "Exception"
}
}
Thanks!
Good library but i'm missing things. I'm looking for ways to control the camera trough PTZ and also retrieve a snapshot of the camera or live video.
I want to help i i can but i don't know how since i've almost never done anything with soap.
Hi,
I'm trying to use your lib and it work for basic data collection but each time I try to call a function, I receive this error.
$o = new Rockyjvec\Onvif\Onvif($SrvURI, $user, $password);
//var_dump($o);
$event = $o->events;
//var_dump($o->media);
$f=$o->media->GetProfiles();
==>>
( ! ) Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] in C:\wamp64\www\ONVIF2\vendor\rockyjvec\onvif\src\Rockyjvec\Onvif\Soap\SoapClient.php on line 61
( ! ) SoapFault: in C:\wamp64\www\ONVIF2\vendor\rockyjvec\onvif\src\Rockyjvec\Onvif\Soap\SoapClient.php on line 61
Call Stack
1 0.0044 362120 {main}( ) ...\index.php:0
2 0.1364 404560 Rockyjvec\Onvif\Soap\SoapClient->GetProfiles( ) ...\index.php:8
3 0.1364 404560 Rockyjvec\Onvif\Soap\SoapClient->__call( $method = 'GetProfiles', $args = [] ) ...\index.php:8
4 0.1366 414112 __call( $name = 'GetProfiles', $args = [] ) ...\SoapClient.php:61
As you can see, I'm working on Windows with PHP 8.0.26
Any idea ?
Thanks
On a PTZ camera, I can get Presets, send presets etc, but I didn't manage to get the stream URI unfortunately, despite spending hours tinkering with the library and checking the ONVIF specs...
Here is how I ask for streams :
$o = new Rockyjvec\Onvif\Onvif("http://192.168.1.47:81/onvif/device_service", "admin", "password");
$o->media->GetProfiles();
$params = [
'StreamSetup'=>
[
'Stream'=>'RTP-Unicast',
'Transport'=>
[
'Protocol'=>'RTSP'
]
],
'ProfileToken' => 'profile_cam1_stream1'
];
print_r($o->media->GetStreamUri($params));
And here is the output :
PHP Fatal error: Uncaught SoapFault exception: [s:Client] Validation constraint violation: empty value provided where a value is required in element 'SOAP-ENC:Struct' in /home/nicolas/Projets/onphp/vendor/rockyjvec/onvif/src/Rockyjvec/Onvif/Soap/SoapClient.php:75
If someone passes by and succesfully cot their camera stream uri :) any help is welcome.
Fatal error: Uncaught Error: Class 'Rockyjvec\Onvif\Onvif\Extension\DeviceIO' not found in /home/capcds/capcds/mrtg/html/vendor/rockyjvec/onvif/src/Rockyjvec/Onvif/Onvif.php:67
$class = "Rockyjvec\Onvif\Onvif/\Extension\" . $name;
to
$class = "Rockyjvec\Onvif\Service/\Extension\" . $name;
Line 59. Please comment
// $class = "Rockyjvec\Onvif\Onvif\Extension\" . $name;
Must be
$class = "Rockyjvec\Onvif\Service\Extension\" . $name;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.