|
我不信还说我引流 你king 你擦
- <?php
- error_reporting(0);//抑制所有错误
- header('Access-Control-Allow-Origin: *');
- header('Content-type:application/json; charset=utf-8');
- echo shuabu($_GET['user'],$_GET['pass'],$_GET['count']);
- function shuabu($user,$pass,$count){
- if($user==''){$json = array("code"=>207,"msg"=>'小米运动账号不能为空',);return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);}
- if($pass==''){$json = array("code"=>202,"msg"=>'小米运动密码不能为空',);return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);}
- if($count==''){$json = array("code"=>205,"msg"=>'小米运动步数不能为空',);return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);}
- if(preg_match("/^1[3456789]\d{9}$/", $user) == 0) {$json = array("code"=>203,"msg"=>'手机号格式错误!',);return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);}
- if(intval($count)<= 0){$json = array("code"=>206,"msg"=>'步数格式错误!',);return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);}
- if(intval($count)>99999){$json = array("code"=>204,"msg"=>'步数最大限制为99999',);return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);}
- $access = login($user,$pass);
- if($access == ''){
- $json = array(
- "code"=>201,
- "msg"=>'小米运动账号或者密码错误',
- );
- return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
- $user_json = get_user($access);
- $user_id = get_user_id($user_json);
- $app_token = get_app_token($user_json);
- $return = json_decode(load($user_id,$app_token,$count),true);
- if($return['code']=='1'){
- $json = array(
- "code"=>200,
- "msg"=>'提交步数成功',
- "user"=>$_GET['user'],
- "count"=>$_GET['count']
- );
- }else{
- $json = array(
- "code"=>208,
- "msg"=>'提交步数失败,API返回结果为:'.$json['message'].'',
- "user"=>$_GET['user'],
- "count"=>$_GET['count']
- );
- }
- return json_encode($json,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
- function login($user,$pass){//登录,成功返回access,失败返回空
- $data_url = 'https://api-user.huami.com/registrations/+86'.$user.'/tokens';
- $post_data = array(
- "client_id" => "HuaMi",
- "country_code" => "CN",
- "password" => $pass,
- "redirect_uri" => "https%3A//s3-us-west-2.amazonaws.com/hm-registration/successsignin.html",
- "state" => "REDIRECTION",
- "token" => "access"
- );
- $return = curl_sport($data_url,$post_data,1);
- if(strexists($return,'access')){
- return GetBetween($return,'access=','&');
- }else{
- return '';
- }
- }
- function get_user($access){//获取用户信息,json类型
- $data_url = 'https://account.huami.com/v2/client/login';
- $post_data="allow_registration=false&app_name=com.xiaomi.hm.health&app_version=4.1.0&code=".$access."&country_code=CN&device_id=device_id_type=uuid&device_model=phone&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&grant_type=access_token&lang=zh_CN&os_version=1.5.0&source=com.xiaomi.hm.health&third_name=huami_phone";
- $return = curl_sport($data_url,$post_data,0);
- return $return;
- }
- function load($user_id,$app_token,$count){//提交步数
- $data_url = "https://api-mifit-cn.huami.com/v1/data/band_data.json?&t=" . time();
- $headers = [
- 'apptoken: ' . $app_token,
- 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.12(0x17000c2d) NetType/WIFI Language/zh_CN'
- ];
- $json = '[{"data_hr":"\/\/\/\/\/\/9L\/\/\/\/\/\/\/\/\/\/\/\/Vv\/\/\/\/\/\/\/\/\/\/\/0v\/\/\/\/\/\/\/\/\/\/\/9e\/\/\/\/\/0n\/a\/\/\/S\/\/\/\/\/\/\/\/\/\/\/\/0b\/\/\/\/\/\/\/\/\/\/1FK\/\/\/\/\/\/\/\/\/\/\/\/R\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/9PTFFpaf9L\/\/\/\/\/\/\/\/\/\/\/\/R\/\/\/\/\/\/\/\/\/\/\/\/0j\/\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p":0,"lt":0,"wk":0,"usrSt":-1440,"usrEd":-1440,"wc":0,"is":0,"lb":0,"to":0,"dt":0,"rhr":0,"ss":0},"stp":{"ttl":' . $count . ',"dis":10627,"cal":510,"wk":41,"rn":50,"runDist":7654,"runCal":397,"stage":[{"start":327,"stop":341,"mode":1,"dis":481,"cal":13,"step":680},{"start":342,"stop":367,"mode":3,"dis":2295,"cal":95,"step":2874},{"start":368,"stop":377,"mode":4,"dis":1592,"cal":88,"step":1664},{"start":378,"stop":386,"mode":3,"dis":1072,"cal":51,"step":1245},{"start":387,"stop":393,"mode":4,"dis":1036,"cal":57,"step":1124},{"start":394,"stop":398,"mode":3,"dis":488,"cal":19,"step":607},{"start":399,"stop":414,"mode":4,"dis":2220,"cal":120,"step":2371},{"start":415,"stop":427,"mode":3,"dis":1268,"cal":59,"step":1489},{"start":428,"stop":433,"mode":1,"dis":152,"cal":4,"step":238},{"start":434,"stop":444,"mode":3,"dis":2295,"cal":95,"step":2874},{"start":445,"stop":455,"mode":4,"dis":1592,"cal":88,"step":1664},{"start":456,"stop":466,"mode":3,"dis":1072,"cal":51,"step":1245},{"start":467,"stop":477,"mode":4,"dis":1036,"cal":57,"step":1124},{"start":478,"stop":488,"mode":3,"dis":488,"cal":19,"step":607},{"start":489,"stop":499,"mode":4,"dis":2220,"cal":120,"step":2371},{"start":500,"stop":511,"mode":3,"dis":1268,"cal":59,"step":1489},{"start":512,"stop":522,"mode":1,"dis":152,"cal":4,"step":238}]},"goal":8000,"tz":"28800"}","source":24,"type":0}]';
- $data = [
- 'data_json' => $json,
- 'userid' => $userid,
- 'device_type' => '0',
- 'last_sync_data_time' => '1597306380',
- 'last_deviceid' => 'DA932FFFFE8816E7',
- ];
- $return=Curl($data_url, $data, null, $headers);
- $return2=json_encode(array('code'=>1,'msg'=>'提交成功'));
- return $return2;
- }
- function get_user_id($user_json){//解析user_json,获取user_id
- $json = json_decode($user_json,true);
- return $json['token_info']['user_id'];
- }
- function get_app_token($user_json){//解析user_json,获取app_token
- $json = json_decode($user_json,true);
- return $json['token_info']['app_token'];
- }
- //取出文本中间文本
- function GetBetween($content,$start,$end){
- $r = explode($start, $content);
- if (isset($r[1])){
- $r = explode($end, $r[1]);
- return $r[0];
- }
- return '';
- }
- //此应用专用curl,返回response_header
- function curl_sport($url,$post=0,$type=0,$request=''){//GET\POST网络请求
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- if($post){
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- }
- if($request!=''){
- $httpheader[] = "apptoken:".$request;
- curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
- }
- //返回 response_header, 该选项非常重要,如果不为 true, 只会获得响应的正文
- curl_setopt($ch, CURLOPT_HEADER, $type);
- curl_setopt($ch, CURLINFO_HEADER_OUT, true);
- curl_setopt($ch, CURLOPT_AUTOREFERER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- $ret = curl_exec($ch);
- curl_close($ch);
- return $ret;
- }
- function strexists($string, $find) {//取字符串中是否包含指定字符串
- return !(strpos($string, $find) === FALSE);
- }
- function Curl($url, $data = null, $cookie = null, $httpheader = null)
- {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
- $httpheader[] = "Connection: keep-alive";
- curl_setopt($curl, CURLOPT_HTTPHEADER, $httpheader);
- if ($data) {
- if (is_array($data)) $data = http_build_query($data);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
- curl_setopt($curl, CURLOPT_POST, 1);
- }
- if($cookie){
- curl_setopt($curl, CURLOPT_COOKIE, $cookie);
- }
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($curl, CURLOPT_HEADER, 1);
- $ret = curl_exec($curl);
- $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
- $header = substr($ret, 0, $headerSize);
- $content = substr($ret, $headerSize);
- $ret = array();
- $ret['header'] = $header;
- $ret['content'] = $content;
- curl_close($curl);
- return $ret;
- }
- ?>
复制代码
|
|