Files
php-flash/qa.php
2024-08-13 15:27:23 +08:00

90 lines
3.1 KiB
PHP

<?php
// $TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjdXN0b21QYXJhbWV0ZXIiOiJxd2VyMTIzNCIsImV4cCI6MTcyMTg3NzE0OCwidXNlcklkIjo3OTg2NTJ9.fddSOIceIpNA_qiT7tLu6fTDFoZMrtxngKIdpgIWKwA'; // zb
$TO = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjdXN0b21QYXJhbWV0ZXIiOiJxd2VyMTIzNCIsImV4cCI6MTcyNDAzMDY4OSwidXNlcklkIjoxOTY0ODg3fQ.CtOIOW2FeobC92YmrxT7M2inxluEMS3348jpqTK57A4';// iuu
$arr = [ $TO];
$activityId = 765647;
$totalCost = '24';
$groupId = 1276594;
foreach ($arr as $token) {
$custom_post_headers = [
'Host: www.shuote.top:8082',
'Connection: keep-alive',
'Request-Channel: MP-WEIXIN',
'X-Access-Token: ' . $token,
'Accept-Encoding: gzip,compress,br,deflate',
'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN',
'Referer: https://servicewechat.com/wxbb50595cab69d719/403/page-frame.html'
];
$url = 'https://www.shuote.top:8082/flash/activity/applyActivity';
$post_data = [
"payAmount" => $totalCost,
"activityId" => $activityId,
"maleCount" => 0,
"femaleCount" => 0,
"payType" => 3,
// "hangPeopleDetails" => [],
"groupId" => $groupId,
// "applyRemark" => "",
// "teamName" => "",
// "idNumber" => "",
// "birthday" => "",
"xbSex" => null,
"cardType" => 1,
// "realName" => "",
// "memberRemarkList" => [],
// "trackActMemberProjectDoList" => []
];
var_dump(json_encode($post_data));
$response = api_request_curl($url, $custom_post_headers, $post_data);
echo $response;
}
function api_request_curl($url, $custom_headers = [], $postData = array())
{
if (empty($url)) return '';
$postData = json_encode($postData);
$curl = curl_init(); //初始化
curl_setopt($curl, CURLOPT_URL, $url); //设置url
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //设置http验证方法
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置curl_exec获取的信息的返回方式
curl_setopt($curl, CURLOPT_POST, 1); //设置发送方式为post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); //设置post的数据
// 如果有自定义请求头,则设置请求头
// if (!empty($custom_headers)) {
// curl_setopt($curl, CURLOPT_HTTPHEADER, $custom_headers);
// }
$array = array_merge($custom_headers, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($postData))
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $array);
// 接受压缩响应
curl_setopt($curl, CURLOPT_ENCODING, '');
$result = curl_exec($curl);
if ($result === false) {
throw new Exception('Http request message :' . curl_error($curl));
}
curl_close($curl);
// 尝试解压缩响应数据
$decoded_response = @gzdecode($result);
if ($decoded_response !== false) {
return $decoded_response;
}
return $result;
}