转自吾爱。不知道联通不做鉴权直接开放给公网随意查询是否合适。
python:
import requests
import json
# 联通手机号码
phone = "xxxxxxxxxxx"
url = "https://weixin.10010js.com/app/charge/qryRealFee"
headers = {
"Host": "weixin.10010js.com",
"Content-Type": "application/json",
"Cache-Control": "no-cache",
"Content-Length": "23",
"Accept": "*/*",
"Referer": "https://weixin.10010js.com/actPage/activity/index28.html?",
"Accept-Language": "zh-cn",
"User-Agent": "Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36"
}
data = {
"phone": phone
}
req = requests.post(url, json.dumps(data), headers=headers)
money = int(req.text)/100
print(money)
php:
<?php
$url="https://weixin.10010js.com/app/charge/qryRealFee";
$data='{"phone":'.'"'.$_GET["phone"].'"}';
echo "您的帐户余额是:<font color=red size=30>".(curl_post($url,$data)/100)."</font>元人民币";
function curl_post($url,$data){
$headers = array(
"Host:weixin.10010js.com",
"Content-Type:application/json",
"Cache-Control:no-cache",
"Content-Length:23",
"Accept:*/*",
"Referer:https://weixin.10010js.com/actPage/activity/index28.html?",
"Accept-Language:zh-cn",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
?>
有人做好现成的,可以直接试试:
调用地址: http://api.dooper.top:8899/api/liantong/?nub=
请求方式:GET
返回类型:JSON
请求示例: http://api.dooper.top:8899/api/liantong/?nub=13288888888
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.