lantosbro/ guzzlehttp-cloudflare
使用GuzzleHTTP绕过Cloudflare保护
dev-main
2023-10-17 18:59 UTC
Requires
- php: ^7.2
- ext-bcmath: *
- ext-curl: *
- guzzlehttp/guzzle: ^6.3
- lantosbro/cloudflare-bypass: dev-master
Requires (Dev)
- phploc/phploc: ^5.0
- phpmd/phpmd: ^2.4
- phpunit/phpunit: ^8.0
- sebastian/phpcpd: ^4.0
- squizlabs/php_codesniffer: ^3.2
This package is not auto-updated.
Last update: 2024-10-02 22:00:15 UTC
README
Guzzle Cloudflare Bypass
(此产品在免费和宽松的许可下可用,但需要财务支持以维持其持续改进。除了维护和稳定性外,还有许多期望添加的功能。)
绕过Cloudflare DDoS保护 - 请谨慎使用
此包基于KyranRana的cloudflare-bypass。
安装
使用composer
composer require jaymoulin/guzzlehttp-cloudflare
用法
$sUrl = 'https://thebot.net/'; $oClient = new \GuzzleHttp\Client([ 'cookies' => new \GuzzleHttp\Cookie\FileCookieJar(tempnam('/tmp', __CLASS__)), 'headers' => ['Referer' => $sUrl], ]); // 1. Create Guzzle instance $aOptions = [ 'cache' => new \CloudflareBypass\Storage($sPathToYourCacheFolder), ]; // Example for cache, this is completely optional, with $sPathToYourCacheFolder a string to your cache folder /** @var \GuzzleHttp\HandlerStack $oHandler */ $oHandler = $oClient->getConfig('handler'); $oHandler->push(\GuzzleCloudflare\Middleware::create($aOptions)); //2. ??? echo (string)$oClient->request('GET', $sUrl)->getBody(); //3. Profit!!