Skip to content

Instantly share code, notes, and snippets.

@StuartGrossman
Created April 15, 2014 22:10
Show Gist options
  • Save StuartGrossman/10782118 to your computer and use it in GitHub Desktop.
Save StuartGrossman/10782118 to your computer and use it in GitHub Desktop.
Assignment
For this Lab you will be making HTTP requests in your terminal using curl and scavenging for data in the response you get back.curl is short for "Client for URL's" and is a tool that allows us to make HTTP requests in our terminal.
________________________________________
Phase 1: Make a GET request to google
In terminal:
curl -v https://www.google.com
Find your response header
1. What status did you get back?
HTTP/1.1 200 OK
2. What content-type did you get back?
Content-Type: text/html; charset=ISO-8859-1
3. What came after the key "Set-Cookie"? PREF=ID=bc30cc5b7a0713d6:FF=0:TM=1397597971:LM=1397597971:S=sgmfBc4_kp9JfM5L; expires=Thu, 14-Apr-2016 21:39:31 GMT; path=/; domain=.google.com
NID=67=s4TQj-_imgoqpk3YPyJ0BUnAhyX3C9q6GsRKpT8SmTrLY0oEH9ikyzYc3DQxe68UNkuRJ-Ns3NFvUph5OtbWaPez0ZycmdpDlyv6a5SW2ialWH-hww1OvslGcrfoOWZS; expires=Wed, 15-Oct-2014 21:39:31 GMT; path=/; domain=.google.com; HttpOnly
4. What date did this request come back on?
Date: Tue, 15 Apr 2014 21:47:38 GMT
5. What came after the key "Transfer-Encoding?"
Transfer-Encoding: chunked
Find your response body
1. What was the first line in your response body?
2. <!doctype html><html
________________________________________
Phase 2: Make a GET request to the OMDBAPI
In terminal:
curl -v http://www.omdbapi.com
Find your response header
1. What status did you get back?
HTTP/1.1 200 OK
2. What content-type did you get back?
< Content-Type: text/html; charset=utf-8
3. What was your content length?
Content-Length: 11859
4. What date did this request come back on?
< Date: Tue, 15 Apr 2014 21:52:45 GMT
Find your response body
1. What was the first line in your response body?
2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
________________________________________
Phase 3: Make a GET request to the OMDBAPI with parameters
Adding handle: conn: 0x7fd11b004000
In terminal:
curl -v http://www.omdbapi.com/?s=Titanic
Find your response header
1. What status did you get back?
2.
HTTP/1.1 200 OK
2. What content-type did you get back?
< Content-Type: text/html; charset=utf-8
3. What was your content length?
< Content-Length: 792
Find your response body
1. Look at the data that came back. What data structures do these look like?
Looks like hash
2. What year did Titanic II come out?
2010
________________________________________
Phase 4: Make a GET request to the OMDBAPI with different parameters
Now search for one of your favorite movies.
curl -v http://www.omdbapi.com/?t=<insert your favorite movie here>
If the title of your favorite movie has spaces, replace these with %20
i.e. curl -v http://www.omdbapi.com/?t=the%20matrix
Find the response header
1. What was the Cache-Control?
No catch
2. What value is after the key Expires?
-1
Find the response body
1. What year was your favorite movie released?
31 mar 1999
2. What was your favorite movie rated?
R rated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment