Solved

cURL always return "401 Unauthorized"

Posted on 2008-06-24
2
1,496 Views
Last Modified: 2010-04-21
Hi,

I'm trying to automatically download log files from our video conference servers. When I try this with a browser is works (authentication -> save file as).

Now I want to use the cURL command in a script to get the files but it wont work. Here the command I use:

curl --anyauth --insecure --proxy-user 'xxx:yyy' --proxy-ntlm --proxy 'http://x.x.x.x:8080/' --connect-timeout '10' --user 'authname:authpw' --output 'output.txt' https://x.x.x.x/localcdr.csv

The result in the output.txt file = 401 Unauthorized - User authentication is required.

Now the tricky part: 1 of the 7 servers is returning the file with the above command, the other 6 wont :(
With a browser => they work.

Who can help me or has some tips?

Thanks in advance
Filips
0
Comment
Question by:Filips
2 Comments
 
LVL 4

Accepted Solution

by:
snrudda earned 250 total points
ID: 21854998
May find a way out of this fuzz by using sniffer like Wireshark (http://www.wireshark.org/) to see what's the difference between 1 and 6 servers.

I'd rather said servers check some secondary attributes like User-agent or Cookies, you may never guess that without sniffer :)
0
 
LVL 6

Author Closing Comment

by:Filips
ID: 31470103
This was a good hint. I didn't do a sniff but checked the headers with another tool. Result: our network guys made an error in the authentication module.

Thanks snrudda
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php help 34 58
MVC - procedural PHP 10 34
Help with PHP 13 27
Ajax and PHP 4 29
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question