9. Great, so how do they become friends?
Domain Name System
DNS translates domains into something computers understand
google.com means nothing
1.1.1.1 means something
15. HTTP Headers
Host - name of the website we’re talking to
User agent - browser version
Cache - remember this, not gonna answer again
Cookies - magic
16. HTTP GET Requests
GET / HTTP/1.1
Host: oneis.us
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X) Firefox/44.0
Accept: text/html,application/xml
Accept-Language: en-US,en,es-MX
Accept-Encoding: gzip, deflate
Cookie: _ga=GA1.2.229765080.1436819046
17. Request sent!
Server gets request
Forwards it to the web server program
Web server gets the file requested
Sends response with requested file contents
18. HTTP Responses
HTTP/1.1 200 OK
Content-Length: 1241
Date: Mon, 01 Feb 2016 17:54:16 GMT
Content-Type: text/html;charset=utf-8
Server: WEBrick/1.3.1 (Ruby/1.8.7/2014-01-28)
[HTML body that’s 1241 characters long]
24. HTTP Post Request
POST /api/set HTTP/1.1
Host: oneis.us
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X) Firefox/44.0
Accept: text/html,application/xml
Accept-Language: en-US,en,es-MX
api_key=lolidunno&submit=submit
25. HTTP Responses
HTTP/1.1 302 Found
Location: https://oneis.us/goaway
Date: Mon, 01 Feb 2016 18:02:39 GMT
Server: WEBrick/1.3.1 (Ruby/1.8.7/2014-01-28)
26. So what the hell are JS and PHP?
PHP runs “server side” (read: on the server)
Never sent to you, generates the HTML
JS runs “client side” (read: in your browser)
Included in HTTP response, manipulates HTML
28. TL;DR
DNS Lookup
Sends request
Server gets reads or runs requested file
Server sends response back
Browser draws response from HTML
Browser requests any other needed files, runs JS