cURL / Mailing Lists / curl-users / Single Mail


Re: login POST with php/libcurl

From: Daniel Stenberg <>
Date: Wed, 7 May 2003 09:21:02 +0200 (CEST)

On Tue, 6 May 2003, Joe Glass wrote:

> With a browser, if I go to, then click on "Member
> Directory", I am sent to a login page with the url
> So it appears a cookie is established.

Cookies are sent in the HTTP header and isn't visible in the URL. In my eyes,
this looks as if they DON'T use cookies and instead pass on session-variables
in the URL itself.

> I can then enter in the username and password and click login, and
> everything is dandy.

> I'm trying to automate this using PHP/libcurl. First, if I try to
> access this site on the command line using:
> curl -u username:passwd ""
> It doesn't work, the same login page is simply returned.

Yes, because it presents a HTML form for you to fill in, and then -u is not
the right answer. Then you need to check the <form> tags and what variables
to pass on using -d etc.

You should probably also expect cookies to be used and follow redirects.

 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
Received on 2003-05-07