修改PHP cURL TLS指纹以绕过Cloudflare「Just a moment」验证

2024-02-28 08:54:21 浏览数 (4)

修改前

微信截图_20240227152804.png微信截图_20240227152804.png

修改后

微信截图_20240227152841.png微信截图_20240227152841.png

核心代码

以下代码使用了自己的一个cURL请求封装库,liesauer/simple-http-client,这里不过多介绍,原生cURL也是一样设置Header和cURL参数的。

代码语言:javascript复制
$responses = SimpleHttpClient::multiGet($urls, [
    'Accept' => 'text/html,application/xhtml xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Accept-Language' => 'zh-CN,zh;q=0.9,en;q=0.8',
    'Sec-Ch-Ua' => '"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
    'Sec-Ch-Ua-Mobile' => '?0',
    'Sec-Ch-Ua-Platform' => '"Windows"',
    'Sec-Fetch-Dest' => 'document',
    'Sec-Fetch-Mode' => 'navigate',
    'Sec-Fetch-Site' => 'none',
    'Sec-Fetch-User' => '?1',
    'Upgrade-Insecure-Requests' => '1',
    'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
], '', '', [
    CURLOPT_FOLLOWLOCATION  => true,
    CURLOPT_MAXREDIRS       => 99,
    CURLOPT_TIMEOUT         => 10,
    CURLOPT_ENCODING        => 'gzip',
    CURLOPT_SSL_CIPHER_LIST => 'AES128, AES256, AES',
]);

参考文章

  • 绕过 Cloudflare 指纹护盾
  • php破解客户端TLS握手指纹

1 人点赞