0

I am trying to load an http basic auth protected jpg from a webcam using php based on accepted answers such as How do I make a request using HTTP basic authentication with PHP curl?

However, I am getting no joy, just getting a curl status code 0

If you go to http://webcamigc.ddns.net:81/tmpfs/auto.jpg you will be prompted for a user/pass by the IP camera (looks like some fairly crude .htaccess to me, use credentials user/user) and you will get a jpg returned. However, the following php is not returning anything. any ideas or help greatly appreciated.

<?php
$login = 'user';
$password = 'user';
$url = 'http://webcamigc.ddns.net:81/tmpfs/auto.jpg';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_PORT , 81);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$result = curl_exec($ch);
curl_close($ch);  
echo($result);
?>
Community
  • 1
  • 1

1 Answers1

0

solved, used url usr/pass parameters available on this camera instead.