QQ钱包交易记录查询API源代码

QQ钱包交易记录查询API源代码

Hackeus
2022-10-11 / 0 评论 / 65 阅读 / 正在检测是否收录...

前言:

在QQ钱包的交易记录随便抓到的
就写成接口分享给大家伙!

代码:

<?php
/* 返回内容类型,默认返回JSON */
header('Content-Type: application/json; charset=utf-8');
/* ========== 接口逻辑区 ========== */
$qq = $_REQUEST['qq'];//操作者的QQ
$skey = $_REQUEST["skey"];//操作者的skey
$pskey = $_REQUEST["pskey"];//操作者的pskey
$type = $_REQUEST['type'];//返回类型
$hh = $_REQUEST["hh"]?:"\r";//换行符号
$url = 'https://myun.tenpay.com/cgi-bin/clientv1.0/qwallet_record_list.cgi?limit=15&uin='.$qq.'';
$cookie='uin=o'.$qq.'; p_uin=o'.$qq.'; skey='.$skey.'; p_skey='.$pskey.'';
$data = get_curl($url,$cookie);
$result=preg_match_all('/"create_time":"(.*?)",/',$data,$time);
preg_match_all('/"desc":"(.*?)",/',$data,$object);
preg_match_all('/"amount_total":"(.*?)",/',$data,$money);
if (empty($qq)) {
    switch ($type) {
        case 'text':
            exit('请输入QQ号码!');
        default:
            exit(send(array('code' => -1, 'text' => '请输入QQ号码!')));
    }
}
if(!empty($result)){
switch ($type) {
    case 'text':
    echo "-------QQ交易记录-------".$hh."";
    for ($i=0; $i <$result ; $i++){
    $name=$object[1][$i];
    $rmb=number_format($money[1][$i]/100,2);
    $sj=$time[1][$i];
    echo ($i+1).".".$name."(".$rmb."元)-[".$sj."]";
    echo "".$hh."";
    }
        exit;
    default:
    for ($i=0; $i <$result ; $i++){
    $name=$object[1][$i];
    $rmb=number_format($money[1][$i]/100,2);
    $sj=$time[1][$i];
    $array[] = array('desc' => $name,'time' =>
    $sj,'money' => $rmb);
    }
    exit(send(array('code' => 1, 'text' => '获取成功!','data' => $array)));
    }}else{
    switch ($type) {
        case 'text':
            exit('获取交易记录失败!');
        default:
        exit(send(array('code' => -2, 'text' => '获取交易记录失败!')));
        }
}
function send($Msg){//输出json
        echo json_encode($Msg,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    }
/* ========== 接口逻辑区 ========== */
function get_curl($url,$cookie){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$header = array();
//curl_setopt($ch,CURLOPT_POST,true);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); //设置等待时间
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //设置cURL允许执行的最长秒数
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
?>

请求参数:
skey/pskey/qq
注:pskey{QQ钱包的}

0

评论

博主关闭了所有页面的评论