<?php
header("Content-type:text/html; charset=UTF-8");
//請檢查環(huán)境是否 開啟 curl init。
function Post($curlPost,$url){
$curlPost = json_encode($curlPost, JSON_UNESCAPED_UNICODE); //將數(shù)組轉(zhuǎn)換為JSON格式
$headers = array(
'Content-Type: application/json; charset=utf-8', //設(shè)置請求頭
'Content-Length: ' . strlen($curlPost), //設(shè)置請求體長度
'Data: ' . gmdate('D, d M Y H:i:s \G\M\T'), // 請?zhí)鎿Q為當前的GMT時間,可參考:https://gitee.com/shsurlink/api-demo/blob/master/hmac-auth/php/test_submit.php
'Authorization: ' . "Signature xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // 請?zhí)鎿Q為您的鑒權(quán)簽名,可參考: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); //設(shè)置請求頭
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'; //請?zhí)鎿Q為您的APIKEY
$post_data = array(
'mobiles' => array(0=>'135xxxxxxxx',1=>'136xxxxxxxx'), //手機號數(shù)組(最多10個)
);
$res = Post($post_data, $target);
print_r($res);
國內(nèi)專業(yè)互聯(lián)網(wǎng)團隊
21年行業(yè)經(jīng)驗
7x24小時售后支持
豐富的行業(yè)經(jīng)驗
Copyright ? 2004-2025 上海思銳信息技術(shù)有限公司 All rights reserved. 滬ICP備07035915號-15 電信增值業(yè)務(wù)許可證:B2-20160082
服務(wù)熱線:
4008 808 898
服務(wù)熱線(工作時間):
4008 808 898
業(yè)務(wù)咨詢(非工作時間):
售后咨詢(非工作時間):