cURL / Mailing Lists / curl-library / Single Mail

curl-library

Perl & Curl

From: Jeremy Rottman <rottmanj_at_hsmove.com>
Date: Mon, 11 Feb 2008 10:17:36 -0800

I am re-writing my rets application in perl, and I have found a few
modules that will help me on my way. One of them being WWW::Curl:easy.

During my testing, I have tested both system curl and perl curl. At this
point I can get the system curl to correctly connect to my server.
However, I am having the hardest time trying to figure out why I cant
get perl curl to connect to the server.

Every time I try to connect, I get a 401 error. I am using the same
connection method that I would use if I was using system curl.

Here is my current code. Any help with this is greatly appreciated.

Perl Code w/ WWW::Curl:easy -

   1.
      $curl->setopt(CURLOPT_URL, $site);
   2.
              $curl->setopt(CURLOPT_USERPWD,"$user:$pass");
   3.
              $curl->setopt(CURLOPT_HTTPAUTH,CURLAUTH_DIGEST);
   4.
             
   5.
              $curl->perform;
   6.
              my $err = $curl->errbuff;
   7.
              my $info = $curl->getingo(CURLINFO_HTTP_CODE);

Perl code w/ system curl

   1.
      system("curl -u $user:$pass --digest $site");

These are the returned headers I get. I know I am using the correct
username and password. Just not sure where I am going wrong with the
curl lib.

   1.
      HTTP/1.1 401 Unauthorized
   2.
      Content-Length: 1944
   3.
      Content-Type: text/html
   4.
      Server: Microsoft-IIS/6.0
   5.
      X-Powered-By: ASP.NET
   6.
      WWW-Authenticate: Digest
      qop="auth",realm="rets_at_marketlinx.com",nonce="7cae785562b23a466376b89adb9aa120",opaque="08022224248204"
   7.
      Date: Fri, 08 Feb 2008 22:24:24 GMT
   8.
      Connection: close
Received on 2008-02-11