Reply to Re: Axis camera and PHP

Your name:

Reply:


Posted by Ulf Kadner on 08/12/07 22:25

Stefano wrote:

> So, after curl_init(), using the function :
>
> curl_setopt($curl, CURLOPT_HTTPAUTH, 'username:password');
>
> I get the same error message as before: 401 Unauthorized.

Right. It was my failure. Better to read my posting before send.
Yesterday i used it like my example but with PROXY* Paramater. worry? :-)

> curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
>
> Seems that username:password is not accepted as CURLOPT_HTTPAUTH set value.
> In that case where should I specify login and password ?

The fast and bad way is URL-injection like this:
http://username:password@example.com/...

The other and better way is to change youre code at line:
$headers.="Authorization: Basic root:password_root".$br.$br;

to:
$headers .= 'Authorization: Basic '
. base64_encode('root:password_root') . $br . $br);

The RFC says username:password must be Base64 encoded.

By the way: A good PHP-Library for doing something more with
http/ftp/... (by a easy way) is Snoopy.
http://sourceforge.net hosts it.

--
_,
_(_p> Ulf [Kado] Kadner
\<_)
^^

[Back to original 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

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