Skip to main content

HTTP for PHPs

HTTP in PHP is how a script receives a request and sends a response. PHP reads the method, headers, query string and body, and returns a status code and content. Frameworks such as Laravel and Symfony add routing, middleware and request objects, so you rarely handle superglobals directly in larger apps.

Stage: Web and Data · Part of the PHP roadmap · Last reviewed 19 November 2026

What to learn in HTTP

HTTP interview questions

How does PHP know whether a request is GET or POST?

The web server passes it in $_SERVER['REQUEST_METHOD']. Code can branch on this value, but real applications usually let a router do it. Form data for POST arrives in $_POST, while JSON bodies are read from php://input.

What problem does a PHP framework solve over plain scripts?

It supplies routing, dependency injection, request and response objects, validation, templating and security defaults in a consistent structure. This avoids repeating boilerplate and mistakes, and makes a codebase easier for a team to read and test.

Where HTTP fits in the PHP roadmap

HTTP belongs to the Web and Data stage (beginner level), which takes about 19 hours. Build applications.

Back to the full PHP roadmap