Correct api authorization

Joined
Feb 24, 2022
Messages
3
Reaction score
0
Location
Ukraine
Right now I'm logged in this way.
PHP:
function reqCam($url, $code = false) {
    $ch = curl_init($url);
    curl_setopt_array($ch, [CURLOPT_USERPWD => "admin:password", CURLOPT_CONNECTTIMEOUT => 15, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HTTPAUTH=>CURLAUTH_ANY]);
    $res = curl_exec($ch);
    if ($code) return curl_getinfo($ch, CURLINFO_HTTP_CODE);
    return $res;
}
And if I make a request for a list of videos, there are 3 authorizations:
  1. /cgi-bin/mediaFileFind.cgi?action=factory.create
  2. /cgi-bin/mediaFileFind.cgi?action=findFile&object={$id[1]}&condition.Channel=1&condition.StartTime=$start&condition.EndTime=$end&condition.Types[0]=dav
  3. /cgi-bin/mediaFileFind.cgi?action=findNextFile&object={$id[1]}&count=100

The documentation says that I should send the correct header and encrypt it via base64, but I never understood what exactly I should do. Has anyone been able to figure out how to properly authorize on camera?
 
Top