Recordings
Lecture 1. HTTP, PHP, Tools, Dev
HTTP
Pipes
http://ryanstutorials.net/linuxtutorial/piping.php
Sockets & Ports
- https://en.wikipedia.org/wiki/IP_address
- https://en.wikipedia.org/wiki/Port_(computer_networking)
- https://en.wikipedia.org/wiki/Network_socket
Protocols, HTTP
- http://www.jmarshall.com/easy/http/
- http://www.w3.org/Protocols/rfc2616/rfc2616.html 1997
- https://en.wikipedia.org/wiki/HTTP/2 2014
HTTP Request
Taken from http://www.jmarshall.com/easy/http/
GET index.php HTTP/1.0
User-Agent: HTTPTool/1.0
HTTP Response
HTTP/1.0 200 OK
Date: Fri, 31 Dec 1999 23:59:59 GM
Content-Length: 14
Content-Type: Text/HTML
<html></html>
Example Telnet
telnet csquiz.lnu.se 81
Cookies, header, session cookie
Example (index.php)
http://www.phptherightway.com/
Vagrant, Sublime,
http://localhost:8085/index.php
PHP as a language
PHP is an interpreted script language.
It is hated and loved (and so by me)
Some of PHP features:
- It is huge on the server side... http://w3techs.com/technologies/overview/programming_language/all
- Easy to deploy
- Fast development time (hacks)
- Lots of great communities, lots of examples, lots of developers.
Some of the downsides:
- It is weakly typed (with type hinting). (PHP7)
- It is slow for number crunching
- It hard to manage larger applications.
Model, View, Controller A quick intro
Why do we need an architecture?
- map
- design guide
- reusable design
- constraints that help us define solution space
https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
- Model Business rules (what would be the same for all use-cases)
- Controller (Use cases, makes changes to the model depending on user input)
- View (interface, generates what user sees)
Please note that MVC has many different interpretations and versions. (check an image search on google)
View
The views responsibilities are to translate input to higher level input and generate output.
Server(PHP) to browser
HTML, Javascript, Images, CSS, URL, setcookie-headers, status code(200 OK)
All this can be generated by PHP.
Example HTMLView
namespaces, class, private, public, constructor, member variable, parameters
Browser to server(PHP)
url, post, cookies, file-upload
Syncronous (ajax)
Session PHPSESSID
0W4tUCe3tTKe