Connect with us

Ranking ATP

[execphp]
$api_url = ‘https://sofasport.p.rapidapi.com/v1/rankings/current?ranking=atp_official’;

$response = wp_remote_get($api_url, array(
‘headers’ => array(
‘X-RapidAPI-Key’ => ‘d9f9384201mshde805737b6eee90p1f34d0jsn81f8cd4a70b0’,
‘X-RapidAPI-Host’ => ‘sofasport.p.rapidapi.com’,
),
));

if (is_array($response) && !is_wp_error($response)) {
$data = json_decode($response[‘body’]);

if (!empty($data->rankings)) {
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;

foreach ($data->rankings as $ranking) {
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
}

echo ‘

‘;
echo ‘

Posición Jugador Puntos
‘ . esc_html($ranking->position) . ‘ ‘ . esc_html($ranking->player_name) . ‘ ‘ . esc_html($ranking->points) . ‘

‘;
} else {
echo ‘No hay datos de ranking disponibles.’;
}
} else {
$error_message = is_wp_error($response) ? $response->get_error_message() : ‘Error desconocido’;
echo ‘Error: ‘ . esc_html($error_message);
}
[/execphp]

Curiosidades

Tambien podría interesarte…

Noticias

2012-2024 Todo Sobre Tenis - Todos los derechos reservados.