What happens when curl calls a PHP endpoint. Requests, responses, GET, POST, and JSON — explained from scratch.
HTTP is the language browsers and servers use to talk to each other. Every time you open a webpage, your browser sends an HTTP request to a server. The server sends back an HTTP response. That exchange is HTTP.
GET — asking for something. The data travels in the URL itself, after a ?. Used for reading.
POST — sending something. The data travels inside the request body, hidden from the URL. Used for writing, saving, or anything sensitive.
API stands for Application Programming Interface. It sounds complicated but the idea is simple: an API is a PHP file (or set of PHP files) that other programs can talk to — not humans, but code.
When Builder runs a curl command to deploy a file, it is talking to the yttcom.net API. The API receives the request, does something, and sends back a structured response.
JSON is a simple way to structure data so that any program can read it. It uses curly braces for objects and square brackets for lists.
Before PHP sends any output, it can set headers — metadata about the response. The most important ones for APIs are Content-Type (telling the caller what format the response is in) and CORS (telling the browser which websites are allowed to call this endpoint).
Every HTTP response includes a number that tells the caller whether the request worked. You have seen these in your browser.
1. Builder runs: curl -X POST file_write_web.php -d "token=..." -d "path=..." -d "content=..."
2. yttcom.net receives the POST request
3. PHP reads $_POST["token"] and checks it
4. PHP reads $_POST["path"] and $_POST["content"]
5. PHP writes the file to disk
6. PHP sends back: {"status":"ok","bytes":4423}
7. Builder reads the response and confirms success
Every endpoint on yttcom.net follows this exact pattern.