By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,847 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,847 IT Pros & Developers. It's quick & easy.

Perl Curl

P: 46
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 -
Expand|Select|Wrap|Line Numbers
  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);
  8.  

Perl code w/ system curl
Expand|Select|Wrap|Line Numbers
  1. system("curl -u $user:$pass --digest $site");
  2.  
Feb 8 '08 #1
Share this Question
Share on Google+
3 Replies


KevinADC
Expert 2.5K+
P: 4,059
use double-quotes when you have to join scalars to make strings

Expand|Select|Wrap|Line Numbers
  1. $curl->setopt(CURLOPT_USERPWD,"$user:$pass");
Hopefully that is all it will take to get it working.
Feb 8 '08 #2

P: 46
Still gives me the same 401 error.

These are the returned headers I get.

Expand|Select|Wrap|Line Numbers
  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@marketlinx.com",nonce="7cae785562b23a466376b89adb9aa120",opaque="08022224248204"
  7. Date: Fri, 08 Feb 2008 22:24:24 GMT
  8. Connection: close
  9.  
Feb 8 '08 #3

eWish
Expert 100+
P: 971
The documentation is to vague to tell if you are doing things correclty. It appears that provided you have the proper username and password it should work. I have not used this module so I can't say for sure.

Edit:
It looks like they have an active mailing list you might seek help there if someone here can't help you.


--Kevin
Feb 9 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.