互亿无线 · 文档中心

奖励营销 - 代码示例


PHP代码示例

//接口类型:互亿无线手机话费充值接口。
// 账户注册:请通过该地址开通账户https://user.ihuyi.com/register.html

$basicUrl = "https://f.ihuyi.com/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×tamp=%s&userna
me=%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('提交失败');
}

现在注册,即享新用户礼包!

在线咨询
电话咨询

服务热线:

4008 808 898

服务热线(工作时间):

4008 808 898

业务咨询(非工作时间):

售后咨询(非工作时间):

验证码已发送到您的手机,请查收!

输入验证码后,点击“开通体验账户”按钮可立即开通体验账户。

收不到短信验证码?
互亿无线不提供接码服务,接码用户请勿点击开通按钮。
×