Hello
I tried download the image from THETA camera with this php code :
error_reporting(E_ALL);
ini_set( 'display_errors','1');
$url ="http://192.168.254.124/osc/commands/execute";
$username = 'THETAYN10113693';
$password = '10113693';
// $parameters json_encode(array("fileType" => "image", "entryCount" => 1, "maxThumbSize" => 0));
$Body = json_encode(array('name' => 'camera.listFiles', 'parameters' => array("fileType" => "image", "entryCount" => 1, "maxThumbSize" => 0)));
$options = array(
CURLOPT_URL => $url,
//CURLOPT_HEADER => true,
CURLOPT_VERBOSE => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false, // for https
CURLOPT_USERPWD => $username . ":" . $password,
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
CURLOPT_POSTFIELDS => $Body
);
$ch = curl_init();
curl_setopt_array( $ch, $options );
$raw_response = curl_exec( $ch );
// echo json_encode($raw_response);
$total_data =json_decode($raw_response,true);
$fileUrl = $total_data['results']['entries'][0]["fileUrl"];
$filename = $total_data['results']['entries'][0]["name"];
//$mime = "image/jpg";
$data = file_get_contents($fileUrl);
header('Content-Type: image/jpeg');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header("Content-Length: ".strlen($data));
$data = file_get_contents($fileUrl);
exit($data);
that is worked and image has been downloaded but when I try open this image I got message :
its appears that we don’t support this file format
and image dont open
I think that is not correct code to download images from Camera. maybe when Camera need Authentication maybe need another code to images download or maybe this code not work with this images type, which made by this Camera. I dont know I hope get Help
thanks so much