Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is tricky. I want to use curl, wget or any other tool to login into a SSL Website which provides a Login Form. Then I want to visit several Links within that Domain and fetch certain images.

I got it to work with this in bash:

curl -c /tmp/cookie.txt -d "login=username&password=passw&send=submit" https://URI

Use the cookie later with

curl -b /tmp/cookie.txt https://URI

The trick was that you have to submit the credentials to the action= adress of the html form field.

Another problem I face now is that this writes no image because the URL of the image is constructed out of some Servlet URI:

<img src="URI/servlet/manyParametersWith?And=AndLotsOf&">
share|improve this question
up vote 0 down vote accepted

Try using Python and mechanize (available for Perl too). You can do something like this:

import mechanize
br.select_form(nr=0) #check yoursite forms to match the correct number
br['Username']='Username' #use the proper input type=text name
br['Password']='Password' #use the proper input type=password name
share|improve this answer
Thank you for your efforts. I will try your example in future projects. – Stephan Kristyn Sep 14 '10 at 1:34

Ok only possibility to write the image is to display it in a browser, for e.g. echo via php and then write it out to disk via php. Some users reported that might work.

share|improve this answer
They are lots of possibilites without browser and PHP – leoluk Aug 21 '10 at 0:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.