互億無(wú)線 · 文檔中心

獎(jiǎng)勵(lì)營(yíng)銷 - 代碼示例


PHP代碼示例

//接口類型:互億無(wú)線手機(jī)話費(fèi)充值接口。
// 賬戶注冊(cè):請(qǐng)通過(guò)該地址開(kāi)通賬戶https://user.ihuyi.com/register.html

$basicUrl = "http://api.ihuyi.com/f/phone?action=recharge&%s";
$username ="cf_testapi";
$apikey ="";
$mobile ="18801850000";
$package = 1;
$orderid ="TEST_".date("YmdHis").mt_rand(100, 1000);
$dataGet = array();
$dataGet["package"] = $package;
$dataGet["username"] = $username;
$dataGet["timestamp"] = date("YmdHis");
$dataGet["mobile"] = $mobile;
$dataGet["orderid"] = $orderid;
$dataGet["sign"] = md5(sprintf("apikey=%s&mobile=%s&orderid=%s&package=%s&timestamp=%s&username=%s",
 $apikey,
 $mobile,
 $orderid,
 $package,
 date("YmdHis"), 
 $username));
$dataReturn = array();
foreach ($dataGet as $key => $row) {
 $dataReturn[] = sprintf("%s=%s", $key, $row);
}
$urlGet = sprintf($basicUrl, implode("&", $dataReturn));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlGet); //定義表單提交地址
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //60秒
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER,"http://" . $_SERVER["HTTP_HOST"]);
curl_setopt($ch, CURLOPT_POST, 0);
$data = curl_exec($ch);
curl_close($ch);
$dataRet = json_decode($data, 1);
if ($dataRet["code"] == 1) {
 //提交成功
 print("提交成功");
 $apiTaskid = $dataRet["taskid"];
} else {
 print("提交失敗");
}

現(xiàn)在注冊(cè),即享新用戶禮包!

在線咨詢
電話咨詢

服務(wù)熱線:

4008 808 898

服務(wù)熱線(工作時(shí)間):

4008 808 898

業(yè)務(wù)咨詢(非工作時(shí)間):

售后咨詢(非工作時(shí)間):

驗(yàn)證碼已發(fā)送到您的手機(jī),請(qǐng)查收!

輸入驗(yàn)證碼后,點(diǎn)擊“開(kāi)通體驗(yàn)賬戶”按鈕可立即開(kāi)通體驗(yàn)賬戶。

收不到短信驗(yàn)證碼?
互億無(wú)線不提供接碼服務(wù),接碼用戶請(qǐng)勿點(diǎn)擊開(kāi)通按鈕。
×