PHP
CLIENT
php
$headers = [];
$headers[] = "x-rapidapi-key: __YOUR_KEY__";
$headers[] = "x-rapidapi-host: flashlive-sports.p.rapidapi.com";
$baseUrl = "https://flashlive-sports.p.rapidapi.com";
$flashliveSession = curl_init();
curl_setopt($flashliveSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($flashliveSession, CURLOPT_HTTPHEADER, $headers);
curl_setopt($flashliveSession, CURLOPT_ENCODING, "");LIST OF SPORTS
php
echo "\r\n__________________ LIST OF SPORTS __________________\n";
curl_setopt($flashliveSession, CURLOPT_URL, $baseUrl . "/v1/sports/list");
$response = curl_exec($flashliveSession);
$responseCode = curl_getinfo($flashliveSession, CURLINFO_HTTP_CODE);
if ($responseCode != 200) {
throw new Exception($responseCode . ": " . $response);
}
$sports = json_decode($response, true);
foreach ($sports["DATA"] as $sport) {
echo sprintf("%s: %s\n", $sport["ID"], $sport["NAME"]);
}
curl_close($flashliveSession);LIST OF EVENTS
php
echo "\r\n__________________ LIST OF EVENTS __________________";
$params = [
"indent_days" => 0, // -1 - yesterday, 0 - today, 1 tomorrow
"locale" => "en_INT", // locale
"timezone" => "-4", // timezone
"sport_id" => "1", // 1 - SOCCER, @/v1/sports/list
];
curl_setopt(
$flashliveSession,
CURLOPT_URL,
$baseUrl . "/v1/events/list" . "?" . http_build_query($params),
);
$response = curl_exec($flashliveSession);
$responseCode = curl_getinfo($flashliveSession, CURLINFO_HTTP_CODE);
if ($responseCode != 200) {
throw new Exception($responseCode . ": " . $response);
}
$items = json_decode($response, true);
foreach ($items["DATA"] as $tournament) {
echo sprintf(
"%s: %s\n",
$tournament["TOURNAMENT_STAGE_ID"],
$tournament["NAME"],
);
foreach ($tournament["EVENTS"] as $event) {
echo sprintf(
" %s | %s — %s | %s:%s | %s\n",
date("Y-m-d H:i:s", $event["START_TIME"]),
$event["HOME_NAME"],
$event["AWAY_NAME"],
$event["HOME_SCORE_CURRENT"] ?? "N/A",
$event["AWAY_SCORE_CURRENT"] ?? "N/A",
$event["STAGE"] ?? "N/A",
);
}
}
curl_close($flashliveSession);EVENT STATISTICS
php
echo "\r\n__________________ EVENT STATISTICS __________________";
$params = [
"event_id" => "6ivhWNOG",
"locale" => "en_INT", // locale
];
curl_setopt(
$flashliveSession,
CURLOPT_URL,
$baseUrl . "/v1/events/statistics" . "?" . http_build_query($params),
);
$response = curl_exec($flashliveSession);
$responseCode = curl_getinfo($flashliveSession, CURLINFO_HTTP_CODE);
if ($responseCode != 200) {
throw new Exception($responseCode . ": " . $response);
}
$items = json_decode($response, true);
foreach ($items["DATA"] as $stage) {
echo $stage["STAGE_NAME"] . "\n";
foreach ($stage["GROUPS"] as $group) {
echo " " . $group["GROUP_LABEL"] . "\n";
foreach ($group["ITEMS"] as $item) {
echo " " .
$item["INCIDENT_NAME"] .
" " .
$item["VALUE_HOME"] .
" " .
$item["VALUE_AWAY"] .
"\n";
}
}
}
curl_close($flashliveSession);ALL THE EVENTS OF THE SEASON
php
echo "\r\n__________________ ALL THE EVENTS OF THE SEASON __________________";
for ($page = 1; $page < 100; $page++) {
$params = [
"locale" => "en_INT", // locale
"tournament_stage_id" => "OEEq9Yvp", // England: Premier League;187;OEEq9Yvp - 2025
"page" => $page,
];
curl_setopt(
$flashliveSession,
CURLOPT_URL,
$baseUrl . "/v1/tournaments/results" . "?" . http_build_query($params),
);
$response = curl_exec($flashliveSession);
$responseCode = curl_getinfo($flashliveSession, CURLINFO_HTTP_CODE);
if ($responseCode == 404) {
break;
}
if ($responseCode != 200) {
throw new Exception($responseCode . ": " . $response);
}
$tournaments = json_decode($response, true);
foreach ($tournaments["DATA"] as $tournament) {
echo $tournament["NAME"] . "\n";
foreach ($tournament["EVENTS"] as $event) {
echo sprintf(
" %s | %s — %s | %s:%s | %s\n",
date("Y-m-d H:i:s", $event["START_TIME"]),
$event["HOME_NAME"],
$event["AWAY_NAME"],
$event["HOME_SCORE_CURRENT"] ?? "N/A",
$event["AWAY_SCORE_CURRENT"] ?? "N/A",
$event["STAGE"] ?? "N/A",
);
}
}
}
curl_close($flashliveSession);