HTTP (HyperText Transfer Protocol) ni njia ambayo browser (mteja) huwasiliana na server.
Kila wakati unapofungua tovuti, browser yako hutuma request (ombi) kwa server, na server hujibu kwa response (majibu).
Mfano, unapofungua https://example.com, browser hutuma GET request kuomba ukurasa huo.
English:
HTTP is the protocol that allows browsers (clients) to communicate with servers.
Every time you visit a website, your browser sends a request, and the server returns a response (HTML, JSON, images, etc.).
________________________________________
⚙️ Mifano ya Code
🔹 Example 1: Basic Request and Response (PHP)
<?php
// request_example.php
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
echo "Server received a GET request!";
}
?>
🔹 Example 2: Using Fetch (JavaScript)
<!DOCTYPE html>
<html lang="sw">
<head><meta charset="UTF-8"><title>HTTP Example</title></head>
<body>
<button id="loadBtn">Tuma Request</button>
<p id="result"></p>

<script>
document.getElementById("loadBtn").addEventListener("click", () => {
fetch("request_example.php")
.then(res => res.text())
.then(data => document.getElementById("result").innerText = data);
});
</script>
</body>
</html>
________________________________________
🎬 YouTube Description
Katika somo hili tumejifunza kuhusu jinsi browser inavyowasiliana na server kupitia HTTP Requests na Responses.
Umeelewa tofauti kati ya GET na POST, na jinsi ya kutumia Fetch API kuwasiliana na backend (PHP).
🔖 Hashtags
#HTTP #WebDevelopment #PHP #FetchAPI #FullStack #LearningCoding #FaulinkTech #WebTutorials #JavaScript