pel/askgeo-api

一个用于消费askgeo API的类。

dev-master 2019-05-10 01:33 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:10:15 UTC


README

Build Status

askgeo-api

关于

这是一个PSR-4 PHP类,用于消费askgeo的API。(https://askgeo.com

初始化

include('AskGeoAPI.php');

// ! Use your own account id and api key. !
$account_id = '1165';
$api_key = 'g1d11a5117a4143be0f5fge5a9e33df4e9103deb5a12658d22512f2a04ba3nk6';
$format = 'obj';
$secure = true;
$curl_options = array();

$api = new Pel\Helper\AskGeoAPI($account_id, $api_key, $format, $secure, $curl_options);

调用

通用调用

$databases = 'TimeZone';
$points = array(45.485169, -73.699036);

$api->get($databases, $points);

// Optional callback and datetime.
$api->get($databases, $points, $callback, $datetime);

时区调用

$points = array([45.485169, -73.699036], [10.5435, -99.32]);

$api->getTimeZone($points);

// Optional callback and datetime.
$api->getTimeZone($points, $callback, $datetime);

其他专用调用

与时区调用类似,askgeo-api也可以直接调用所有可用的数据库。更多信息请查看源代码。