Good morning,
i have small problem to echo a variable. Maybe you can help me. Thanks!
https://api.openligadb.de/index.html
/getmatchdata/matchid
This works:
<?php echo $match["team1"]["teamIconUrl"]; ?>
But i’m not able to get the matchresult.
<?php echo $match["matchResults"]["pointsTeam1"]; ?>
<?php
// Retrieve the data for the current matchday from the OpenLigaDB API
$url = sprintf("https://api.openligadb.de/getmatchdata/bl1", $current);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
if ($output === false) {
die("Error when requesting the API: " . curl_error($ch));
}
curl_close($ch);
// Decoding the API response
$matches = json_decode($output, true);
if ($matches === null) {
die("Error processing API response: " . json_last_error_msg());
}
?>