2015-10-14 132 views
0

我想基于公认的答案,例如How do I make a request using HTTP basic authentication with PHP curl?JPG,HTTP基本身份验证和PHP

不过,我没有得到任何快乐,刚开的卷曲状态使用PHP的一个摄像头加载的HTTP基本验证保护JPG代码0

如果你去http://webcamigc.ddns.net:81/tmpfs/auto.jpg你会被IP摄像机提示用户/传递(看起来像一些相当原始的.htaccess给我,使用凭据用户/用户),你会得到一个JPG返回。但是,下面的php没有返回任何东西。任何想法或帮助非常感谢。

<?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); 
?> 

回答

0

解决了,使用了url usr/pass参数来替代这台相机。

+0

他们的语法是什么? –