├── LICENSE ├── README.md └── qdbeer.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Truelovefortony 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 联通青岛啤酒自动抽奖脚本 2 | 3 | 新版(m.client.10010.com/sma-lottery/qpactivity/qingpiindex)联通青岛啤酒转盘自动抽奖 4 | 5 | 支持多个号码批量 6 | 7 | 调用BaiduAI(ai.baidu.com)识别验证码 8 | 9 | 只需要PHP环境支持CURL即可 10 | 11 | 修改qdbeer.php中的APIKey&SecretKey(BaiduAI平台申请),号码Array,修改完毕后放在PHP环境或虚拟主机中运行即可,搭配Cron定时访问可全自动 12 | -------------------------------------------------------------------------------- /qdbeer.php: -------------------------------------------------------------------------------- 1 | 9999 or $yzm<1000); 86 | $postdata="mobile=$hm&image=$yzm&userid=$JSESSIONID"; 87 | $yzmres=curl('https://m.client.10010.com/sma-lottery/validation/qpImgValidation.htm',0,$postdata,1,$cookies); 88 | $res_arr = json_decode($yzmres, true); 89 | if($res_arr["code"] != "YES"){$res[0]=false;$res[1]='2db565dc0843d5cdcef92e2db17a81ee';$res[2]='1111';}else{$res[0]=true;$res[1]=$res_arr["mobile"];$res[2]=$yzm;} 90 | return $res; 91 | } 92 | 93 | function ocr_yzm($hm,$bdat,$pic){//AI识别验证码 94 | $Postdata = "access_token=$bdat&image=".urlencode($pic); 95 | $bdyzm = curl('https://aip.baidubce.com/rest/2.0/ocr/v1/numbers',0,$Postdata,1); 96 | $ocr_arr = json_decode($bdyzm, true); 97 | if(empty($ocr_arr["words_result"][0]["words"])){$yzm=999;}else{$yzm=$ocr_arr["words_result"][0]["words"];} 98 | return $yzm; 99 | } 100 | function get_yzmpic($cookies){//获取验证码 101 | $JSESSIONID=$cookies[0]; 102 | $SL=$cookies[1]; 103 | $cookies="SL=$SL; JSESSIONID=$JSESSIONID"; 104 | $time=time().rand(100,999); 105 | $url="https://m.client.10010.com/sma-lottery/qpactivity/getSysManageLoginCode.htm?userid=$JSESSIONID&code=$time"; 106 | $getyzm=curl($url,0,0,0,$cookies); 107 | return base64_encode($getyzm); 108 | } 109 | function qhtml_userid(){//HTML页面获取参数 110 | $qdhtml=curl('https://m.client.10010.com/sma-lottery/qpactivity/qingpiindex',1); 111 | $ret = preg_match('/userid\" type=\"hidden\" value=\"(.*)\"/',$qdhtml,$matchs); 112 | if($ret >= 1){ $arr[0]=$matchs[1];}else{return false;} 113 | $ret = preg_match('/SL=(.*)\; E/',$qdhtml,$matchs); 114 | if($ret >= 1){ $arr[1]=$matchs[1];}else{return false;} 115 | return $arr; 116 | } 117 | function bd_ocr_at($APIKey,$SecretKey){//百度AI-Token 118 | $url = 'https://aip.baidubce.com/oauth/2.0/token'; 119 | $post_data = "grant_type=client_credentials&client_id=${APIKey}&client_secret=${SecretKey}"; 120 | $res = curl($url,0,$post_data,1); 121 | //var_dump($res); 122 | $arr_bd = json_decode($res, true); 123 | if (empty($arr_bd["access_token"])){return false;}else{return $arr_bd["access_token"];} 124 | } 125 | function curl($url = '',$tou=0,$param = '',$post=0,$cookies='JSESSIONID=D146A2338E29418E6F31ACEC30409D89'){//CURL模块 126 | if (empty($url)) { return false; } 127 | $curl = curl_init();//初始化curl 128 | curl_setopt($curl, CURLOPT_USERAGENT, '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'); 129 | curl_setopt($curl, CURLOPT_TIMEOUT, 5); 130 | curl_setopt($curl, CURLOPT_URL,$url); 131 | //curl_setopt($curl, CURLOPT_PROXY, "127.0.0.1"); 132 | //curl_setopt($curl, CURLOPT_PROXYPORT, 8888); 133 | curl_setopt($curl,CURLOPT_HTTPHEADER,array( 134 | 'Cookie: '.$cookies 135 | ,'Upgrade-Insecure-Requests: 1' 136 | )); 137 | if($tou){curl_setopt($curl, CURLOPT_HEADER, 1);}//设置header 138 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 139 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 140 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 141 | if($post){//post提交方式 142 | curl_setopt($curl, CURLOPT_POST, 1); 143 | curl_setopt($curl, CURLOPT_POSTFIELDS, $param); 144 | } 145 | $data = curl_exec($curl);//运行curl 146 | if (curl_errno($curl)) { return false; } 147 | curl_close($curl); 148 | return $data; 149 | } 150 | ?> --------------------------------------------------------------------------------