/**
* 使用curl模拟登陆
* User: yun
* Date: 2019/7/20
* Time: 11:09
*/
public static function login()
{
//账号信息
$postData = [
'username' => self::USERNAME,
'password' => self::PASS,
];
//消息头
$header = [
'Host: xxx.xxx.com',
'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0',
'Accept: application/json, text/plain, */*',
'Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding: gzip, deflate, br',
'Referer: http://xxx.xxx.com/',
'Content-Type: application/json;charset=UTF-8',
'Origin: http://xxx.xxx.comm',
'Content-Length: '.strlen(json_encode($postData)),
'Connection: keep-alive',
];
$curl = curl_init();
$cookie = tempnam
laravel 框架 试用curl模拟登陆
最新推荐文章于 2021-03-13 04:08:04 发布