本文付费阅读内容 - 免费资源
<title>Apibug - QQ微信支付宝刷步数</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no, viewport-fit=cover">
<?php
error_reporting(0);
date_default_timezone_set("Etc/GMT-8");
//获取加秒数的时间戳
function getMillisecond() {
list($t1, $t2) = explode(' ', microtime());
return (float)sprintf('%.0f',(floatval($t1)+floatval($t2))*1000);
}
//post函数
function curl($url, $data='', $method='POST',$header){
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
if($method=='POST'){
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
if ($data != ''){
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
}
}
curl_setopt($curl, CURLOPT_ENCODING ,'gzip');
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
curl_close($curl); // 关闭CURL会话
return $tmpInfo; // 返回数据
}
//登录的post,取cookie,Content-Type必须加上
$header = [
'Content-Type: application/json; charset=utf-8',
];
$url="sports.lifesense.com/sessions_service/login?systemType=2&version=4.6.7";
$data = '{"appType":6,"clientId":"88888","loginName":"'.$_GET['mobile'].'","password":"'.md5($_GET['psw']).'","roleType":0}';
$html = curl($url,$data,$method='POST',$header);
$html=json_decode($html,true);
//这两个参数下面的post需要
$accessToken= $html['data']['accessToken'];
$userId=$html['data']['userId'];
$step = $_GET['step'];
//取到参数添加到刷步数的post里
$url="sports.lifesense.com/sport_service/sport/sport/uploadMobileStepV2?version=4.5&systemType=2";
$header = [
'Cookie: accessToken='.$accessToken,
'Content-Type: application/json; charset=utf-8',
];
//步数距离时间戳都要加上才能成功
$data = '{"list":[{"DataSource":2,"active":1,"calories":"'.intval($step/4).'","dataSource":2,"deviceId":"M_NULL","distance":'.intval($step/3).',"exerciseTime":0,"isUpload":0,"measurementTime":"'.date("Y-m-d H:i:s",time()).'","priority":0,"step":'.$step.',"type":2,"updated":'.getMillisecond().',"userId":'.$userId.'}]}';
$html = curl($url,$data,$method='POST',$header);
$html=json_decode($html,true);
$steps = $html['data']['pedometerRecordHourlyList'][0]['step'];
if(!empty($steps)){
echo '刷步成功,当前步数:'.$steps;
}else if(empty($json[resultObj])){
echo "刷步数失败了,请检查账号密码和步数,如无误请在试一次";
}
?>
请登录后发表评论
注册
社交帐号登录