Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // استدعاء البيانات من API أو مصدر آخر
- $data = file_get_contents("https://www.football-data.org/v2/competitions/PL/matches", false, stream_context_create([
- "http" => [
- "header" => "Accept: application/json\r\nX-Auth-Token: YOUR_API_KEY_HERE"
- ]
- ]));
- // تحويل البيانات من صيغة JSON إلى مصفوفة PHP
- $matches = json_decode($data, true)["matches"];
- // عرض النتائج
- foreach ($matches as $match) {
- echo $match["homeTeam"]["name"] . " " . $match["score"]["fullTime"]["homeTeam"] . " - " . $match["score"]["fullTime"]["awayTeam"] . " " . $match["awayTeam"]["name"] . "<br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement