I want to get the current time from the server using IP

I want to get the current time from the server using ip so i am using ap-api for that, but it is free for 45 reqests per minute . so can you suggest some other methods i will post my code below

function get_user_time_zone() {
    $ip_address = $_SERVER['REMOTE_ADDR'];
    $response = wp_remote_get('http://ip-api.com/json/');
    if (is_wp_error($response)) {
        return 'UTC';
    }
    $data = json_decode(wp_remote_retrieve_body($response));
    return $data && isset($data->timezone) ? $data->timezone : 'UTC';
}

Hi,

Please note that this is a custom development and is not a HivePress scope. We recommend checking other APIs as we are not familiar with this API.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.