You are here: Re: Axis camera and PHP « PHP Language « IT news, forums, messages
Re: Axis camera and PHP

Posted by Stefano on 08/13/07 19:53

You're right. It works now using base64_encode().
Thanks.
Stefano


"C." <colin.mckinnon@gmail.com> ha scritto nel messaggio
news:1187006754.240830.17030@g4g2000hsf.googlegroups.com...
> On 12 Aug, 16:34, "Stefano" <o...@interfree.it> wrote:
>> I have to send a restart command to an IP camera from a PHP script. The
>> command is as follow:
>>
>> http://192.168.1.5/axis-cgi/admin/restart.cgi
> <snip>
>> $usarname="root";
>> $password="password_root";
>> $sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ;
>> if(!is_resource($sk)){
>> exit("Connection failed: ".$errnum." ".$errstr) ;}
>>
>> else{
>> $headers = "GET ".$target." HTTP/1.1".$br ;
>> $headers.="Accept: */*".$br ;
>> $headers.="Accept-Language: it".$br ;
>> $headers.="Host: ".$host.$br ;
>> $headers.="Authorization: Basic root:password_root".$br.$br;
>> fputs($sk,$headers) ;
>>
> <snip>
>> When printing $sk I see the error message
>>
>> 401 Unauthorized
>> You client does not have permission to get URL
>> /axis-cgi/admin/restart.cgi
>> from this server
>>
>
> Why are you rolling your own HTTP stack? PHP comes with 2 builtin
> methods - file wrappers and Curl which are both capable of handling
> basic authentication (and ssl).
>
> One reason your code is not working is because you haven't base64
> encoded the username and password (and you're sending literals not
> variables).
>
> C.
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация