use curl to fetch some HTTP and HTML results.

README.md 1.7KB

ZCW-CurlLab

Step through each section.

When you see below a question:

Q: What is your name?

Add your answer to Comments.md file. Run the commands, each one and determine the answer to add.

  1. Open a terminal
  2. cd to the directory where you put this repo.
  3. Copy these commands into that terminal, stepping through each one.
  4. use curl to fetch some URLs

One

curl --trace-ascii debugdump.txt http://www.example.com/
curl --trace-ascii debugdump.txt http://www.example.com/ >> results.txt

curl https://curl.haxx.se
curl https://curl.haxx.se >> results.txt

Q: Which HTTP command (verb) is being used by the last two curl commands?

Two

curl -o example.com.html http://www.example.com/
more example.com.html
open example.com.html

curl -o a350.jpg https://static01.nyt.com/images/2018/05/30/business/30SINGAPORE/merlin_138828375_8d2c8b23-ea8a-43d3-89d1-5556b11ccf5b-jumbo.jpg?quality=90&auto=webp
open a350.jpg

Add to Comments.md the answer to this question:

Q: -o seems to do what?

Three

curl -I http://google.com curl -I http://google.com >> results.txt curl -I http://zipcodewilmington.com

Q: -I shows what?

Q: And how is that -I different from a simple GET (what does it show)?

Four

curl -I -L http://zipcodewilmington.com curl -I -L http://zipcodewilmington.com >> results.txt

Q: How many actual HTTP responses are there in that result?

Q: The first one's result code is a 301 and second's result code is a WHAT?

(This was how a REDIRECT works, first you see a 301 and then get redirected to the actual site.)

Five

and now do:

Save your answers in Comments.md and:

wc results.txt
wc results.txt >> results.txt

now: do a git add, commit and push. Then do a Pull Request. Thx.