vmgltd / hlr-lookup-api-php-sdk
www.hlr-lookups.com官方HLR查询API PHP SDK
0.0.14
2017-09-09 11:08 UTC
Requires
- php: >=5.3.0
- ext-curl: *
README
由www.hlr-lookups.com提供的官方HLR查询API SDK for PHP。直接从网络运营商获取实时手机连接和可移植性数据。
此SDK实现了在https://www.hlr-lookups.com/en/api-docs中记录的REST API,包括HLR API(实时连接),NT API(号码类型)以及MNP API(手机号码可移植性)。
有关不同编程语言的SDK,请参阅https://www.hlr-lookups.com/en/api-docs#sdks
要求
- PHP >=5.3.0
- PHP的cURL扩展
- PHP的OpenSSL扩展
作为Drop-In安装
将src
目录的内容复制到项目的“包含路径”中。
客户端使用
include('HlrLookupClient.class.php'); $client = new HlrLookupClient( 'YOUR-API-KEY', 'YOUR-API-SECRET', '/var/log/hlr-lookups.log' // an optional log file location );
在此处获取您的API密钥和密码。
示例
测试认证 (认证文档)
对GET /auth-test
端点进行认证请求。状态码200表示您已使用您的API凭证成功认证。
$response = $client->get('/auth-test'); if ($response->httpStatusCode == 200) { // authentication was successful }
提交HLR查询 (HLR API文档)
$response = $client->post('/hlr-lookup', array( 'msisdn' => '+905536939460' )); // capture the HTTP status code and response body $status_code = $response->httpStatusCode; $data = $response->responseBody;
HLR API响应对象
{ "id":"f94ef092cb53", "msisdn":"+14156226819", "connectivity_status":"CONNECTED", "mccmnc":"310260", "mcc":"310", "mnc":"260", "imsi":"***************", "msin":"**********", "msc":"************", "original_network_name":"Verizon Wireless", "original_country_name":"United States", "original_country_code":"US", "original_country_prefix":"+1", "is_ported":true, "ported_network_name":"T-Mobile US", "ported_country_name":"United States", "ported_country_code":"US", "ported_country_prefix":"+1", "is_roaming":false, "roaming_network_name":null, "roaming_country_name":null, "roaming_country_code":null, "roaming_country_prefix":null, "cost":"0.0100", "timestamp":"2020-08-07 19:16:17.676+0300", "storage":"SYNC-API-2020-08", "route":"IP1", "processing_status":"COMPLETED", "error_code":null, "data_source":"LIVE_HLR" }
关于HLR API响应中属性和连接状态的详细文档在此。
提交号码类型(NT)查询 (NT API文档)
$response = $client->post('/nt-lookup', array( 'number' => '+4989702626' )); // capture the HTTP status code and response body $status_code = $response->httpStatusCode; $data = $response->responseBody;
NT API响应对象
{ "id":"2ed0788379c6", "number":"+4989702626", "number_type":"LANDLINE", "query_status":"OK", "is_valid":true, "invalid_reason":null, "is_possibly_ported":false, "is_vanity_number":false, "qualifies_for_hlr_lookup":false, "mccmnc":null, "mcc":null, "mnc":null, "original_network_name":null, "original_country_name":"Germany", "original_country_code":"DE", "regions":[ "Munich" ], "timezones":[ "Europe/Berlin" ], "info_text":"This is a landline number.", "cost":"0.0050", "timestamp":"2015-12-04 10:36:41.866283+00", "storage":"SYNC-API-NT-2015-12", "route":"LC1" }
关于NT API响应中属性和连接状态的详细文档在此。
提交MNP查询(手机号码可移植性) (MNP API文档)
$response = $client->post('/mnp-lookup', array( 'msisdn' => '+14156226819' )); // capture the HTTP status code and response body $status_code = $response->httpStatusCode; $data = $response->responseBody;
MNP API响应对象
{ "id":"e428acb1c0ae", "msisdn":"+14156226819", "query_status":"OK", "mccmnc":"310260", "mcc":"310", "mnc":"260", "is_ported":true, "original_network_name":"Verizon Wireless:6006 - SVR/2", "original_country_name":"United States", "original_country_code":"US", "original_country_prefix":"+1415", "ported_network_name":"T-Mobile US:6529 - SVR/2", "ported_country_name":"United States", "ported_country_code":"US", "ported_country_prefix":"+1", "extra":"LRN:4154250000", "cost":"0.0050", "timestamp":"2020-08-05 21:21:33.490+0300", "storage":"WEB-CLIENT-SOLO-MNP-2020-08", "route":"PTX", "error_code":null }
关于MNP API响应中属性和连接状态的详细文档在此。
API文档
请检查https://www.hlr-lookups.com/en/api-docs以获取详细的API文档,或通过service@hlr-lookups.com给我们发邮件。
支持和反馈
我们感谢您的反馈!如果您对此SDK有特定的问题或错误,请在Github上提交问题。对于一般反馈和支持请求,请通过service@hlr-lookups.com给我们发邮件。
贡献
- 分叉它( https://github.com/vmgltd/hlr-lookup-api-php-sdk/fork )
- 创建您的功能分支(
git checkout -b my-new-feature
) - 提交您的更改(
git commit -am '添加一些功能'
) - 推送到分支(
git push origin my-new-feature
) - 创建一个新的 Pull Request