-1

I can download few files from https site through web browser.

By using the proper credentials, is it possible to download the https pages through command line ( that too non-interactively ) ?

e.g. To download This image non-interactively through command line with proper credentials, I will search for lines with "png" extension

PLEASE VOTE TO CLOSE THE QUESTION ( I am bit confuse, what to ask exactly )

SHW
  • 14,786
  • 14
  • 66
  • 101
  • 2
    You don't need credentials to download that page. You seem to be confusing a secure connection (HTTPS) and authorization to access a certain page (credentials) – Anthon May 27 '14 at 11:39
  • May be. All I need is to download few pages by command line from site ( https) after authorization – SHW May 29 '14 at 06:48
  • How are the credentials asked for. Is this basic HTTP authentication? Or some cookie based scheme using OAUTH? We need to know in order to answer your question, because you might need something like selenium if the authorization uses more than a basic scheme. – Anthon May 29 '14 at 07:08
  • @SHW Why did you edit your question to vote to close? There is a delete button. – Bernhard May 29 '14 at 09:18
  • It won't allowing me to delete as there are some answers – SHW May 29 '14 at 09:49

2 Answers2

2

I downloaded the linked image with

wget https://blog.httpwatch.com/wp-content/uploads/2011/01/firefox-https-cache2.png

Is this what you want?

Suppose that you wanted to download many files (e.g. *-cache1,2,3,4,5,6,7,8,9.png). Then you could do something like:

for i in {1..9}; do 
wget https://blog.httpwatch.com/wp-content/uploads/2011/01/firefox-https-cache$i.png
done

If you need to use authentication this and other googled results will be helpful. If security concerns you, be certain to hide your credentials, since most likely they will appear on your shell history (e.g. ~/.bash_history).

Konstantinos
  • 1,120
  • The above link was an example. This site do not required the credentials to access that site – SHW May 28 '14 at 10:05
2

Use wget or curl, see the examples:

wget https://blog.httpwatch.com/wp-content/uploads/2011/01/firefox-https-cache2.png

Or:

curl -o file.png https://blog.httpwatch.com/wp-content/uploads/2011/01/firefox-https-cache2.png

Both applications are highy configurable and adjustable and are meant to use in automated scripts.

chaos
  • 48,171