<?php
require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$mobile = '15158825888';//手机号
$amount = '30';//充值金额
$outorderno = '66522311111';//外部订单号
$appsecret = 'ssssssssssss';
$sign = makeSign(array('mobile'=>$mobile, 'amount'=>$amount, 'outorderno'=>$outorderno), $appsecret);//签名 mobile amount outorderno为签名字段,参考下面的签名函数
$url = "https://api.jisuapi.com/mobilerecharge/recharge?appkey=$appkey&mobile=$mobile&amount=$amount&outorderno=$outorderno&sign=$sign";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
echo $jsonarr['msg'];
exit();
}
$result = $jsonarr['result'];
echo $result['mobile'].' '.$result['amount'].' '.$result['outorderno'].'
';
echo $result['orderno'].' '.$result['totalfee'].' '.$result['rechargestatus'].'
';
function makeSign($queryarr, $appsecret)
{
ksort($queryarr, SORT_STRING);
$str = implode($queryarr);
$str .= $appsecret;
//exit($str);
$str = md5($str);
return $str;
}