<?php
header("Content-type:text/html; charset=UTF-8");
//请检查环境是否 开启 curl init。
function Post($curlPost,$url){
$curlPost = json_encode($curlPost, JSON_UNESCAPED_UNICODE); //将数组转换为JSON格式
$headers = array(
'Content-Type: application/json; charset=utf-8', //设置请求头
'Content-Length: ' . strlen($curlPost), //设置请求体长度
'Data: ' . gmdate('D, d M Y H:i:s \G\M\T'), // 请替换为当前的GMT时间,可参考:https://gitee.com/shsurlink/api-demo/blob/master/hmac-auth/php/test_submit.php
'Authorization: ' . "Signature xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // 请替换为您的鉴权签名,可参考:https://gitee.com/shsurlink/api-demo/blob/master/hmac-auth/php/test_submit.php
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); //设置请求头
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$return_str = curl_exec($curl);
curl_close($curl);
return $return_str;
}
//短信接口地址
$target = "https://api.ihuyi.com/empty-number/submit";
$api_key = 'xxxxxxxxxxxxxx'; //请替换为您的APIKEY
$post_data = array(
'mobiles' => array(0=>'135xxxxxxxx',1=>'136xxxxxxxx'), //手机号数组(最多10个)
);
$res = Post($post_data, $target);
print_r($res);
国内专业互联网团队
21年行业经验
7x24小时售后支持
丰富的行业经验
Copyright © 2004-2025 上海思锐信息技术有限公司 All rights reserved. 沪ICP备07035915号-15 电信增值业务许可证:B2-20160082
服务热线:
4008 808 898
服务热线(工作时间):
4008 808 898
业务咨询(非工作时间):
售后咨询(非工作时间):