curl-users
Re: Basic Authentication from command-line cURL
Date: Wed, 20 Jul 2005 09:28:41 -0700 (PDT)
thanx 4 ur reply, man.
i did try it using browser. this is my code:
<?php
$url='https://xxx.xxx.net/AuthenticateXmlServer.aspx';
$user_agent="Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0)";
$username = "plain_username";
$password = "plain_password";
$userpass = $username.':'.$password;
$stringxml = file_get_contents('xxxx.xml');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $userpass);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $stringxml);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
echo curl_error ($ch);
$Reply = curl_exec($ch);
curl_close($ch);
echo '$Reply: '.$Reply;
?>
still i ended up with '401 unauthorized'.
any idea??? ^_^
thanks!
laurent
--- Alexander Lazic <al-curlusers_at_none.at> wrote:
> On Die 19.07.2005 14:37, pURbA wrote:
> >
> >they said, they have configured the username &
> password. 8-(
> >
> >any other suggestion? ^_^
>
> from curl -M|less
> ---
> -u/--user <user:password>
> Specify user and password to use
> for server authentication.
> Overrides -n/--netrc and
> --netrc-optional.
>
> If this option is used several times,
> the last one will be used.
>
> ---
>
> BTW: Have you try to connect with a Browser?!
>
> al ;-)
>
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
Received on 2005-07-20