'espn-1.png', 'ESPN 2' => 'espn-2.png', 'ESPN 3' => 'espn-3.png', 'ESPN 4' => 'espn4.png', 'DAZN' => 'dazn.png', 'Disney' => 'Disney%2B.png', 'Sportv' => 'sportv.png', 'Sportv 2' => 'sportv-2.png', 'Sportv 3' => 'sportv-3.png', 'Prime' => 'primevideo.png', 'Premiere Clubes' => 'premiere.png', 'Premiere 2' => 'premiere-2.png', 'Premiere 3' => 'premiere-3.png', 'Premiere 4' => 'premiere-4.png', 'Premiere 5' => 'premiere-5.png', 'Premiere 6' => 'premiere-6.png', 'Premiere 7' => 'premiere-7.png', 'Sport tv' => 'sportvtv-1.png', 'Sport tv 2' => 'sportvtv-2.png', 'Sport tv 3' => 'sportvtv-3.png', 'Sport tv 4' => 'sportvtv-4.png', 'Globo' => 'globorj.png', 'Globo SP' => 'globosp.png', 'Globo MG' => 'globomg.png', ]; // Mapeamento de emissoras por ID de time $emissorasPorTime = [ 142 => ['ESPN', 'Disney'], // Cruzeiro 127 => ['Sportv', 'Premiere'], // Atlético-MG 129 => ['ESPN', 'Sportv'], // América-MG // Adicione mais times conforme necessário ]; function initCurlRequest($url, $apiHost, $apiKey) { $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 15, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: $apiHost", "x-rapidapi-key: $apiKey" ], ]); return $curl; } $multiCurl = []; $curlHandles = curl_multi_init(); foreach ($leagueIds as $leagueId) { foreach ($teamIds as $teamId) { $urlToday = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateToday"; $urlTomorrow = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateTomorrow"; $multiCurl[] = initCurlRequest($urlToday, $apiHost, $apiKey); $multiCurl[] = initCurlRequest($urlTomorrow, $apiHost, $apiKey); } } foreach ($multiCurl as $ch) { curl_multi_add_handle($curlHandles, $ch); } $running = null; do { curl_multi_exec($curlHandles, $running); curl_multi_select($curlHandles); } while ($running > 0); foreach ($multiCurl as $ch) { $response = curl_multi_getcontent($ch); $data = json_decode($response, true); if (!empty($data['response'])) { $results = array_merge($results, $data['response']); } curl_multi_remove_handle($curlHandles, $ch); } curl_multi_close($curlHandles); // Processa os jogos encontrados e associa emissoras dinamicamente foreach ($results as &$fixture) { $homeId = $fixture['teams']['home']['id'] ?? null; $awayId = $fixture['teams']['away']['id'] ?? null; // Recupera emissoras de cada time $emissorasHome = $emissorasPorTime[$homeId] ?? []; $emissorasAway = $emissorasPorTime[$awayId] ?? []; // Junta e remove duplicatas $emissorasUnicas = array_unique(array_merge($emissorasHome, $emissorasAway)); $fixture['emissoras'] = []; foreach ($emissorasUnicas as $nome) { if (isset($emissoraLogos[$nome])) { $fixture['emissoras'][] = [ 'nome' => $nome, 'logo' => $emissoraLogos[$nome] ]; } } // Compatibilidade com campos antigos (emissoraLogo1, 2, 3) $fixture['emissoraLogo1'] = $fixture['emissoras'][0]['logo'] ?? null; $fixture['emissoraLogo2'] = $fixture['emissoras'][1]['logo'] ?? null; $fixture['emissoraLogo3'] = $fixture['emissoras'][2]['logo'] ?? null; } // Retorno JSON header('Content-Type: application/json'); echo json_encode($results); __________________________________________________-DETALHES___________________________ $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: api-football-v1.p.rapidapi.com", "x-rapidapi-key: 1526a8ba86mshdfde00e60390ee5p16f08djsn9fc3085d429e" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { die("Erro cURL: $err"); } return json_decode($response, true); } // Dados da partida $fixtureData = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?id=$fixtureId"); $fixture = $fixtureData['response'][0] ?? null; if (!$fixture) { die('Partida não encontrada.'); } $fixtureInfo = $fixture['fixture']; $teams = $fixture['teams']; $scores = $fixture['goals']; $venue = $fixture['venue']; $homeTeamId = $teams['home']['id']; $awayTeamId = $teams['away']['id']; $leagueId = $fixture['league']['id'] ?? 71; $season = $fixture['league']['season'] ?? 2024; // Últimos jogos $homeMatches = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?team=$homeTeamId&last=5")['response'] ?? []; $awayMatches = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?team=$awayTeamId&last=5")['response'] ?? []; // Escalação $lineups = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures/lineups?fixture=$fixtureId")['response'] ?? []; // Classificação $standings = callApi("https://api-football-v1.p.rapidapi.com/v3/standings?league=$leagueId&season=$season")['response'][0]['league']['standings'][0] ?? []; // Abreviações function abbreviateTeamName($name) { $abbreviations = [ 'Cruzeiro' => 'CRU', 'Internacional' => 'INT', 'São Paulo' => 'SPP', 'Flamengo' => 'FLA', ]; return strtoupper($abbreviations[$name] ?? substr($name, 0, 3)); } // Mapeamento de logos $emissoraLogos = [ 'ESPN' => 'espn-1.png', 'ESPN 2' => 'espn-2.png', 'Disney' => 'Disney%2B.png', 'Sportv' => 'sportv.png', 'Premiere' => 'premiere.png', 'Globo' => 'globorj.png', 'Prime' => 'primevideo.png', ]; // Emissoras por time (exemplo fictício) $emissorasPorTime = [ 127 => ['ESPN', 'Sportv'], 128 => ['ESPN', 'Prime'], 142 => ['Globo'], 139 => ['Premiere', 'ESPN'], // Adicione seus mapeamentos reais aqui ]; // Emissoras dinâmicas $emissoras = []; if (isset($emissorasPorTime[$homeTeamId])) { foreach ($emissorasPorTime[$homeTeamId] as $nome) { if (isset($emissoraLogos[$nome])) { $emissoras[] = [ 'nome' => $nome, 'logo' => $emissoraLogos[$nome] ]; } } } ?> ?> Detalhes da Partida

Detalhes

setTimezone(new DateTimeZone('America/Sao_Paulo')); echo $matchDate->format('d/m H:i'); ?>

Onde Assistir

<?php echo htmlspecialchars($emissora['nome']); ?>
Onde Assistir
"; // Time da casa echo "
"; echo "

" . htmlspecialchars($homeTeam['team']['name']) . "

"; echo "
    "; foreach ($homeTeam['startXI'] as $player) { $name = htmlspecialchars($player['player']['name']); $number = $player['player']['number']; $pos = htmlspecialchars($player['player']['pos']); echo "
  • $number $name $pos
  • "; } echo "
"; // Time visitante echo "
"; echo "

" . htmlspecialchars($awayTeam['team']['name']) . "

"; echo "
    "; foreach ($awayTeam['startXI'] as $player) { $name = htmlspecialchars($player['player']['name']); $number = $player['player']['number']; $pos = htmlspecialchars($player['player']['pos']); echo "
  • $number $name $pos
  • "; } echo "
"; echo "
"; } else { echo "

Escalações não disponíveis.

"; } ?>
"; echo " Pos Time Pts J V E D SG "; foreach ($standings as $pos => $teamStanding) { $posicao = $pos + 1; $team = $teamStanding['team']; $nome = htmlspecialchars($team['name']); $teamId = $team['id']; $logo = $team['logo']; $pts = $teamStanding['points']; $jogos = $teamStanding['all']['played']; $vitorias = $teamStanding['all']['win']; $empates = $teamStanding['all']['draw']; $derrotas = $teamStanding['all']['lose']; $golsPro = $teamStanding['all']['goals']['for']; $golsContra = $teamStanding['all']['goals']['against']; $saldoGols = $golsPro - $golsContra; // Classe da linha para destaque do time $rowClass = ''; if ($teamId == $homeTeamId || $teamId == $awayTeamId) { $rowClass = 'destaque-time'; } // Define classe para o card de posição if ($posicao >= 1 && $posicao <= 4) { $posClass = 'g4'; } elseif ($posicao >= 5 && $posicao <= 6) { $posClass = 'pre-libertadores'; } elseif ($posicao >= 7 && $posicao <= 12) { $posClass = 'sulamericana'; } elseif ($posicao >= 13 && $posicao <= 16) { $posClass = 'neutro'; } else { // 17 a 20 $posClass = 'z4'; } echo " $posicao logo$nome $pts $jogos $vitorias $empates $derrotas $saldoGols "; } echo ""; } else { echo "

Classificação não disponível.

"; } ?>

Últimos Jogos do

  • <?php echo abbreviateTeamName($match['teams']['home']['name']); ?> Logo
    <?php echo abbreviateTeamName($match['teams']['away']['name']); ?> Logo

Últimos Jogos do

  • <?php echo abbreviateTeamName($match['teams']['home']['name']); ?> Logo
    <?php echo abbreviateTeamName($match['teams']['away']['name']); ?> Logo
'espn-1.png', 'ESPN 2' => 'espn-2.png', 'ESPN 3' => 'espn-3.png', 'ESPN 4' => 'espn4.png', 'DAZN' => 'dazn.png', 'Disney' => 'Disney%2B.png', 'Sportv' => 'sportv.png', 'Sportv 2' => 'sportv-2.png', 'Sportv 3' => 'sportv-3.png', 'Prime' => 'primevideo.png', 'Premiere Clubes' => 'premiere.png', 'Premiere 2' => 'premiere-2.png', 'Premiere 3' => 'premiere-3.png', 'Premiere 4' => 'premiere-4.png', 'Premiere 5' => 'premiere-5.png', 'Premiere 6' => 'premiere-6.png', 'Premiere 7' => 'premiere-7.png', 'Sport tv' => 'sportvtv-1.png', 'Sport tv 2' => 'sportvtv-2.png', 'Sport tv 3' => 'sportvtv-3.png', 'Sport tv 4' => 'sportvtv-4.png', 'Globo' => 'globorj.png', 'Globo SP' => 'globosp.png', 'Globo MG' => 'globomg.png', ]; // Mapeamento de emissoras por ID de time $emissorasPorTime = [ $emissorasPorTime = [ 125 => ['Premiere', 'Globo'], // Cuiabá 126 => ['Sportv', 'Premiere'], // Fortaleza 127 => ['Sportv', 'Premiere'], // Atlético-MG 128 => ['ESPN', 'Disney'], // Vasco 129 => ['ESPN', 'Sportv'], // América-MG 130 => ['Premiere', 'Disney'], // Bahia 131 => ['Sportv', 'Globo'], // Red Bull Bragantino 132 => ['Premiere', 'ESPN'], // Internacional 133 => ['Globo', 'Disney'], // São Paulo 134 => ['Premiere', 'Sportv'], // Grêmio 135 => ['Premiere', 'Disney'], // Flamengo 136 => ['Sportv', 'ESPN'], // Fluminense 137 => ['Premiere', 'Disney'], // Palmeiras 138 => ['Sportv', 'Globo'], // Corinthians 139 => ['Premiere', 'Sportv'], // Botafogo 140 => ['Globo', 'Disney'], // Coritiba 141 => ['Premiere', 'ESPN'], // Goiás 142 => ['ESPN', 'Disney'], // Cruzeiro 143 => ['Premiere', 'Sportv'], // Avaí 144 => ['Globo', 'Disney'], // Ponte Preta 145 => ['Sportv', 'Premiere'], // CRB 146 => ['ESPN', 'Disney'], // Juventude 147 => ['Premiere', 'Sportv'], // Vitória 148 => ['Globo', 'ESPN'], // Ceará 149 => ['Premiere', 'Disney'], // Chapecoense 150 => ['ESPN', 'Sportv'], // Londrina 151 => ['Premiere', 'Globo'], // Vila Nova 152 => ['Sportv', 'Disney'], // Sampaio Corrêa 153 => ['ESPN', 'Premiere'], // Ituano 154 => ['Globo', 'Premiere'], // Guarani 155 => ['Sportv', 'ESPN'], // Tombense 156 => ['Premiere', 'Disney'], // Mirassol 157 => ['Sportv', 'ESPN'], // Novorizontino 158 => ['Globo', 'Sportv'], // ABC 159 => ['Premiere', 'ESPN'], // Criciúma 160 => ['Disney', 'Premiere'], // Atlético-GO ]; function initCurlRequest($url, $apiHost, $apiKey) { $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 15, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: $apiHost", "x-rapidapi-key: $apiKey" ], ]); return $curl; } $multiCurl = []; $curlHandles = curl_multi_init(); foreach ($leagueIds as $leagueId) { foreach ($teamIds as $teamId) { $urlToday = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateToday"; $urlTomorrow = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateTomorrow"; $multiCurl[] = initCurlRequest($urlToday, $apiHost, $apiKey); $multiCurl[] = initCurlRequest($urlTomorrow, $apiHost, $apiKey); } } foreach ($multiCurl as $ch) { curl_multi_add_handle($curlHandles, $ch); } $running = null; do { curl_multi_exec($curlHandles, $running); curl_multi_select($curlHandles); } while ($running > 0); foreach ($multiCurl as $ch) { $response = curl_multi_getcontent($ch); $data = json_decode($response, true); if (!empty($data['response'])) { $results = array_merge($results, $data['response']); } curl_multi_remove_handle($curlHandles, $ch); } curl_multi_close($curlHandles); // Processa os jogos encontrados e associa emissoras dinamicamente foreach ($results as &$fixture) { $homeId = $fixture['teams']['home']['id'] ?? null; $awayId = $fixture['teams']['away']['id'] ?? null; // Recupera emissoras de cada time $emissorasHome = $emissorasPorTime[$homeId] ?? []; $emissorasAway = $emissorasPorTime[$awayId] ?? []; // Junta e remove duplicatas $emissorasUnicas = array_unique(array_merge($emissorasHome, $emissorasAway)); $fixture['emissoras'] = []; foreach ($emissorasUnicas as $nome) { if (isset($emissoraLogos[$nome])) { $fixture['emissoras'][] = [ 'nome' => $nome, 'logo' => $emissoraLogos[$nome] ]; } } // Compatibilidade com campos antigos (emissoraLogo1, 2, 3) $fixture['emissoraLogo1'] = $fixture['emissoras'][0]['logo'] ?? null; $fixture['emissoraLogo2'] = $fixture['emissoras'][1]['logo'] ?? null; $fixture['emissoraLogo3'] = $fixture['emissoras'][2]['logo'] ?? null; } // Retorno JSON header('Content-Type: application/json'); echo json_encode($results); <-------------------------------------- HTML NO SITE COM LOGO DE EMISSORAS --------------------------------> Ao Vivo

JOGOS DE HOJE

'espn-1.png', 'ESPN 2' => 'espn-2.png', 'ESPN 3' => 'espn-3.png', 'ESPN 4' => 'espn4.png', 'DAZN' => 'dazn.png', 'Disney' => 'Disney%2B.png', 'Sportv' => 'sportv.png', 'Sportv 2' => 'sportv-2.png', 'Sportv 3' => 'sportv-3.png', 'Prime' => 'primevideo.png', 'Premiere Clubes' => 'premiere.png', 'Premiere 2' => 'premiere-2.png', 'Premiere 3' => 'premiere-3.png', 'Premiere 4' => 'premiere-4.png', 'Premiere 5' => 'premiere-5.png', 'Premiere 6' => 'premiere-6.png', 'Premiere 7' => 'premiere-7.png', 'Sport tv' => 'sportvtv-1.png', 'Sport tv 2' => 'sportvtv-2.png', 'Sport tv 3' => 'sportvtv-3.png', 'Sport tv 4' => 'sportvtv-4.png', 'Globo' => 'globorj.png', 'Globo SP' => 'globosp.png', 'Globo MG' => 'globomg.png', ]; // Mapeamento de emissoras por ID de time $emissorasPorTime = [ 125 => ['Premiere', 'Globo'], // Cuiabá 126 => ['Sportv', 'Premiere'], // Fortaleza 127 => ['Sportv', 'ESPN'], // Atlético-MG 128 => ['ESPN', 'Disney'], // Vasco 129 => ['ESPN', 'Sportv'], // América-MG 130 => ['Premiere', 'Disney'], // Bahia 131 => ['Sportv', 'globorj'], // Red Bull Bragantino 132 => ['Premiere', 'ESPN'], // Internacional 133 => ['globosp', 'Disney'], // São Paulo 134 => ['Premiere', 'Sportv'], // Grêmio 135 => ['Premiere', 'Disney'], // Flamengo 136 => ['Sportv', 'ESPN'], // Fluminense 137 => ['Premiere', 'Disney'], // Palmeiras 138 => ['Sportv', 'globorj'], // Corinthians 139 => ['Premiere', 'Sportv'], // Botafogo 140 => ['Globo', 'Disney'], // Coritiba 141 => ['Premiere', 'ESPN'], // Goiás 142 => ['ESPN', 'Disney'], // Cruzeiro 143 => ['Premiere', 'Sportv'], // Avaí 144 => ['Globo', 'Disney'], // Ponte Preta 145 => ['Sportv', 'Premiere'], // CRB 146 => ['ESPN', 'Disney'], // Juventude 147 => ['Premiere', 'Sportv'], // Vitória 148 => ['Globo', 'ESPN'], // Ceará 149 => ['Premiere', 'Disney'], // Chapecoense 150 => ['ESPN', 'Sportv'], // Londrina 151 => ['Premiere', 'Globo'], // Vila Nova 152 => ['Sportv', 'Disney'], // Sampaio Corrêa 153 => ['ESPN', 'Premiere'], // Ituano 154 => ['Globo', 'Premiere'], // Guarani 155 => ['Sportv', 'ESPN'], // Tombense 156 => ['Premiere', 'Disney'], // Mirassol 157 => ['Sportv', 'ESPN'], // Novorizontino 158 => ['Globo', 'Sportv'], // ABC 159 => ['Premiere', 'ESPN'], // Criciúma 160 => ['Disney', 'Premiere'], // Atlético-GO ]; function initCurlRequest($url, $apiHost, $apiKey) { $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 15, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: $apiHost", "x-rapidapi-key: $apiKey" ], ]); return $curl; } $multiCurl = []; $curlHandles = curl_multi_init(); foreach ($leagueIds as $leagueId) { foreach ($teamIds as $teamId) { $urlToday = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateToday"; $urlTomorrow = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateTomorrow"; $multiCurl[] = initCurlRequest($urlToday, $apiHost, $apiKey); $multiCurl[] = initCurlRequest($urlTomorrow, $apiHost, $apiKey); } } foreach ($multiCurl as $ch) { curl_multi_add_handle($curlHandles, $ch); } $running = null; do { curl_multi_exec($curlHandles, $running); curl_multi_select($curlHandles); } while ($running > 0); foreach ($multiCurl as $ch) { $response = curl_multi_getcontent($ch); $data = json_decode($response, true); if (!empty($data['response'])) { $results = array_merge($results, $data['response']); } curl_multi_remove_handle($curlHandles, $ch); } curl_multi_close($curlHandles); // Processa os jogos encontrados e associa emissoras dinamicamente foreach ($results as &$fixture) { $homeId = $fixture['teams']['home']['id'] ?? null; $awayId = $fixture['teams']['away']['id'] ?? null; // Recupera emissoras de cada time $emissorasHome = $emissorasPorTime[$homeId] ?? []; $emissorasAway = $emissorasPorTime[$awayId] ?? []; // Junta e remove duplicatas $emissorasUnicas = array_unique(array_merge($emissorasHome, $emissorasAway)); $fixture['emissoras'] = []; foreach ($emissorasUnicas as $nome) { if (isset($emissoraLogos[$nome])) { $fixture['emissoras'][] = [ 'nome' => $nome, 'logo' => $emissoraLogos[$nome] ]; } } // Compatibilidade com campos antigos (emissoraLogo1, 2, 3) $fixture['emissoraLogo1'] = $fixture['emissoras'][0]['logo'] ?? null; $fixture['emissoraLogo2'] = $fixture['emissoras'][1]['logo'] ?? null; $fixture['emissoraLogo3'] = $fixture['emissoras'][2]['logo'] ?? null; } // Retorno JSON header('Content-Type: application/json'); echo json_encode($results); $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: api-football-v1.p.rapidapi.com", "x-rapidapi-key: 1526a8ba86mshdfde00e60390ee5p16f08djsn9fc3085d429e" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { die("Erro cURL: $err"); } return json_decode($response, true); } // Dados da partida $fixtureData = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?id=$fixtureId"); $fixture = $fixtureData['response'][0] ?? null; if (!$fixture) { die('Partida não encontrada.'); } $fixtureInfo = $fixture['fixture']; $teams = $fixture['teams']; $scores = $fixture['goals']; $venue = $fixture['venue']; $homeTeamId = $teams['home']['id']; $awayTeamId = $teams['away']['id']; $leagueId = $fixture['league']['id'] ?? 71; $season = $fixture['league']['season'] ?? 2024; // Últimos jogos $homeMatches = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?team=$homeTeamId&last=5")['response'] ?? []; $awayMatches = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?team=$awayTeamId&last=5")['response'] ?? []; // Escalação $lineups = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures/lineups?fixture=$fixtureId")['response'] ?? []; // Classificação $standings = callApi("https://api-football-v1.p.rapidapi.com/v3/standings?league=$leagueId&season=$season")['response'][0]['league']['standings'][0] ?? []; // Abreviações function abbreviateTeamName($name) { $abbreviations = [ 'Cruzeiro' => 'CRU', 'Internacional' => 'INT', 'São Paulo' => 'SPP', 'Flamengo' => 'FLA', ]; return strtoupper($abbreviations[$name] ?? substr($name, 0, 3)); } // Mapeamento de logos $emissoraLogos = [ 'ESPN' => 'espn-1.png', 'ESPN 2' => 'espn-2.png', 'Disney' => 'Disney%2B.png', 'Sportv' => 'sportv.png', 'Premiere' => 'premiere.png', 'Globo' => 'globorj.png', 'Prime' => 'primevideo.png', ]; // Emissoras por time (exemplo fictício) $emissorasPorTime = [ 125 => ['Premiere', 'Globo'], // Cuiabá 126 => ['Sportv', 'Premiere'], // Fortaleza 127 => ['Sportv', 'Premiere'], // Atlético-MG 128 => ['ESPN', 'Disney'], // Vasco 129 => ['ESPN', 'Sportv'], // América-MG 130 => ['ESPN', 'Disney'], // Bahia 131 => ['Sportv', 'Globo'], // Red Bull Bragantino 132 => ['Premiere', 'ESPN'], // Internacional 133 => ['Globo', 'Disney'], // São Paulo 134 => ['Premiere', 'Sportv'], // Grêmio 135 => ['ESPN', 'Disney'], // Flamengo 136 => ['Sportv', 'ESPN'], // Fluminense 137 => ['Premiere', 'Disney'], // Palmeiras 138 => ['Sportv', 'Globo'], // Corinthians 139 => ['Premiere', 'Sportv'], // Botafogo 140 => ['Globo', 'Disney'], // Coritiba 141 => ['Premiere', 'ESPN'], // Goiás 142 => ['ESPN', 'Disney'], // Cruzeiro 143 => ['Premiere', 'Sportv'], // Avaí 144 => ['Globo', 'Disney'], // Ponte Preta 145 => ['Sportv', 'Premiere'], // CRB 146 => ['ESPN', 'Disney'], // Juventude 147 => ['Premiere', 'Sportv'], // Vitória 148 => ['Globo', 'ESPN'], // Ceará 149 => ['Premiere', 'Disney'], // Chapecoense 150 => ['ESPN', 'Sportv'], // Londrina 151 => ['Premiere', 'Globo'], // Vila Nova 152 => ['Sportv', 'Disney'], // Sampaio Corrêa 153 => ['ESPN', 'Premiere'], // Ituano 154 => ['Globo', 'Premiere'], // Guarani 155 => ['Sportv', 'ESPN'], // Tombense 156 => ['Premiere', 'Disney'], // Mirassol 157 => ['Sportv', 'ESPN'], // Novorizontino 158 => ['Globo', 'Sportv'], // ABC 159 => ['Premiere', 'ESPN'], // Criciúma 160 => ['Disney', 'Premiere'], // Atlético-GO ]; // Emissoras dinâmicas $emissoras = []; if (isset($emissorasPorTime[$homeTeamId])) { foreach ($emissorasPorTime[$homeTeamId] as $nome) { if (isset($emissoraLogos[$nome])) { $emissoras[] = [ 'nome' => $nome, 'logo' => $emissoraLogos[$nome] ]; } } } ?> Detalhes da Partida

Detalhes

setTimezone(new DateTimeZone('America/Sao_Paulo')); echo $matchDate->format('d/m H:i'); ?>

Onde Assistir

<?php echo htmlspecialchars($emissora['nome']); ?>
Onde Assistir
"; // Time da casa echo "
"; echo "

" . htmlspecialchars($homeTeam['team']['name']) . "

"; echo "
    "; foreach ($homeTeam['startXI'] as $player) { $name = htmlspecialchars($player['player']['name']); $number = $player['player']['number']; $pos = htmlspecialchars($player['player']['pos']); echo "
  • $number $name $pos
  • "; } echo "
"; // Time visitante echo "
"; echo "

" . htmlspecialchars($awayTeam['team']['name']) . "

"; echo "
    "; foreach ($awayTeam['startXI'] as $player) { $name = htmlspecialchars($player['player']['name']); $number = $player['player']['number']; $pos = htmlspecialchars($player['player']['pos']); echo "
  • $number $name $pos
  • "; } echo "
"; echo "
"; } else { echo "

Escalações não disponíveis.

"; } ?>
"; echo " Pos Time Pts J V E D SG "; foreach ($standings as $pos => $teamStanding) { $posicao = $pos + 1; $team = $teamStanding['team']; $nome = htmlspecialchars($team['name']); $teamId = $team['id']; $logo = $team['logo']; $pts = $teamStanding['points']; $jogos = $teamStanding['all']['played']; $vitorias = $teamStanding['all']['win']; $empates = $teamStanding['all']['draw']; $derrotas = $teamStanding['all']['lose']; $golsPro = $teamStanding['all']['goals']['for']; $golsContra = $teamStanding['all']['goals']['against']; $saldoGols = $golsPro - $golsContra; // Classe da linha para destaque do time $rowClass = ''; if ($teamId == $homeTeamId || $teamId == $awayTeamId) { $rowClass = 'destaque-time'; } // Define classe para o card de posição if ($posicao >= 1 && $posicao <= 4) { $posClass = 'g4'; } elseif ($posicao >= 5 && $posicao <= 6) { $posClass = 'pre-libertadores'; } elseif ($posicao >= 7 && $posicao <= 12) { $posClass = 'sulamericana'; } elseif ($posicao >= 13 && $posicao <= 16) { $posClass = 'neutro'; } else { // 17 a 20 $posClass = 'z4'; } echo " $posicao logo$nome $pts $jogos $vitorias $empates $derrotas $saldoGols "; } echo ""; } else { echo "

Classificação não disponível.

"; } ?>

Últimos Jogos do

  • <?php echo abbreviateTeamName($match['teams']['home']['name']); ?> Logo
    <?php echo abbreviateTeamName($match['teams']['away']['name']); ?> Logo

Últimos Jogos do

  • <?php echo abbreviateTeamName($match['teams']['home']['name']); ?> Logo
    <?php echo abbreviateTeamName($match['teams']['away']['name']); ?> Logo
<-------------------------------------- HTML NO SITE COM LOGO ESCRITO --------------------------------> Ao Vivo

JOGOS DE HOJE

['Premiere 2', 'Sportv 2'], 128 => ['ESPN', 'Disney'], 129 => ['Globo', 'Sportv'] ]; function initCurlRequest($url, $apiHost, $apiKey) { $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 15, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: $apiHost", "x-rapidapi-key: $apiKey" ], ]); return $curl; } $multiCurl = []; $curlHandles = curl_multi_init(); foreach ($leagueIds as $leagueId) { foreach ($teamIds as $teamId) { $urlToday = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateToday"; $urlTomorrow = "https://$apiHost/v3/fixtures?league=$leagueId&team=$teamId&season=$season&date=$dateTomorrow"; $multiCurl[] = initCurlRequest($urlToday, $apiHost, $apiKey); $multiCurl[] = initCurlRequest($urlTomorrow, $apiHost, $apiKey); } } foreach ($multiCurl as $ch) { curl_multi_add_handle($curlHandles, $ch); } $running = null; do { curl_multi_exec($curlHandles, $running); curl_multi_select($curlHandles); } while ($running > 0); foreach ($multiCurl as $ch) { $response = curl_multi_getcontent($ch); $data = json_decode($response, true); if (!empty($data['response'])) { $results = array_merge($results, $data['response']); } curl_multi_remove_handle($curlHandles, $ch); } curl_multi_close($curlHandles); // Aplicar emissoras com base nos times (home ou away) foreach ($results as &$fixture) { $homeId = $fixture['teams']['home']['id']; $awayId = $fixture['teams']['away']['id']; $emissoras = $emissorasPorTime[$homeId] ?? $emissorasPorTime[$awayId] ?? []; $fixture['emissoraNome1'] = $emissoras[0] ?? null; $fixture['emissoraNome2'] = $emissoras[1] ?? null; $fixture['emissoraNome3'] = $emissoras[2] ?? null; } header('Content-Type: application/json'); echo json_encode($results); $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: api-football-v1.p.rapidapi.com", "x-rapidapi-key: c3ca48fa82mshaffa9878342ebe2p151169jsn3ae01cad6112" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { die("Erro cURL: $err"); } return json_decode($response, true); } // Dados da partida $fixtureData = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?id=$fixtureId"); $fixture = $fixtureData['response'][0] ?? null; if (!$fixture) { die('Partida não encontrada.'); } $fixtureInfo = $fixture['fixture']; $teams = $fixture['teams']; $scores = $fixture['goals']; $venue = $fixture['venue']; $homeTeamId = $teams['home']['id']; $awayTeamId = $teams['away']['id']; // Força liga e season para garantir $leagueId = $fixture['league']['id'] ?? 71; // Substitua 71 pelo ID correto se quiser fixo $season = $fixture['league']['season'] ?? 2024; // Últimos jogos times $homeMatchesData = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?team=$homeTeamId&last=5"); $homeMatches = $homeMatchesData['response'] ?? []; $awayMatchesData = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures?team=$awayTeamId&last=5"); $awayMatches = $awayMatchesData['response'] ?? []; // Escalação $lineupsData = callApi("https://api-football-v1.p.rapidapi.com/v3/fixtures/lineups?fixture=$fixtureId"); $lineups = $lineupsData['response'] ?? []; // Emissoras fixas (igual seu exemplo, pode ajustar) $possibleEmissoras = ['Disney', 'Sportv', 'ESPN']; // Aqui atribuindo ao fixture para usar no HTML $fixture['emissoraNome1'] = $possibleEmissoras[0] ?? null; $fixture['emissoraNome2'] = $possibleEmissoras[1] ?? null; $fixture['emissoraNome3'] = $possibleEmissoras[2] ?? null; $emissoras = array_filter([ $fixture['emissoraNome1'], $fixture['emissoraNome2'], $fixture['emissoraNome3'], ]); // Classificação $standingsData = callApi("https://api-football-v1.p.rapidapi.com/v3/standings?league=$leagueId&season=$season"); $standings = $standingsData['response'][0]['league']['standings'][0] ?? []; function abbreviateTeamName($name) { $abbreviations = [ 'Cruzeiro' => 'CRU', 'Internacional' => 'INT', 'São Paulo' => 'SPP', 'Flamengo' => 'FLA', ]; return strtoupper($abbreviations[$name] ?? substr($name, 0, 3)); } ?> Detalhes da Partida

Detalhes da Partida

setTimezone(new DateTimeZone('America/Sao_Paulo')); echo $matchDate->format('d/m H:i'); ?>

Onde Assistir

"; // Casa echo "
"; echo "

" . htmlspecialchars($homeTeamLineup['team']['name']) . "

"; echo "
    "; foreach ($homeTeamLineup['startXI'] as $player) { echo "
  • " . $player['player']['number'] . " " . htmlspecialchars($player['player']['name']) . " " . htmlspecialchars($player['player']['pos']) . "
  • "; } echo "
"; // Visitante echo "
"; echo "

" . htmlspecialchars($awayTeamLineup['team']['name']) . "

"; echo "
    "; foreach ($awayTeamLineup['startXI'] as $player) { echo "
  • " . $player['player']['number'] . " " . htmlspecialchars($player['player']['name']) . " " . htmlspecialchars($player['player']['pos']) . "
  • "; } echo "
"; echo "
"; } else { echo "

Escalações não disponíveis.

"; } ?>

Últimos Jogos do

  • <?php echo abbreviateTeamName($match['teams']['home']['name']); ?> Logo
    <?php echo abbreviateTeamName($match['teams']['away']['name']); ?> Logo

Últimos Jogos do

  • <?php echo abbreviateTeamName($match['teams']['home']['name']); ?> Logo
    <?php echo abbreviateTeamName($match['teams']['away']['name']); ?> Logo
"; echo " Pos Time Pts J V E D SG "; foreach ($standings as $pos => $teamStanding) { $posicao = $pos + 1; $team = $teamStanding['team']; $nome = htmlspecialchars($team['name']); $teamId = $team['id']; $logo = $team['logo']; $pts = $teamStanding['points']; $jogos = $teamStanding['all']['played']; $vitorias = $teamStanding['all']['win']; $empates = $teamStanding['all']['draw']; $derrotas = $teamStanding['all']['lose']; $golsPro = $teamStanding['all']['goals']['for']; $golsContra = $teamStanding['all']['goals']['against']; $saldoGols = $golsPro - $golsContra; // Classe da linha para destaque do time $rowClass = ''; if ($teamId == $homeTeamId || $teamId == $awayTeamId) { $rowClass = 'destaque-time'; } // Define classe para o card de posição if ($posicao >= 1 && $posicao <= 4) { $posClass = 'g4'; } elseif ($posicao >= 5 && $posicao <= 6) { $posClass = 'pre-libertadores'; } elseif ($posicao >= 7 && $posicao <= 12) { $posClass = 'sulamericana'; } elseif ($posicao >= 13 && $posicao <= 16) { $posClass = 'neutro'; } else { // 17 a 20 $posClass = 'z4'; } echo " $posicao logo$nome $pts $jogos $vitorias $empates $derrotas $saldoGols "; } echo ""; } else { echo "

Classificação não disponível.

"; } ?>