votong / guzzlehttp-cloudflare
使用 GuzzleHTTP 绕过 Cloudflare 保护
1.0.4
2024-05-01 16:26 UTC
Requires
- php: ^7.2
- ext-bcmath: *
- ext-curl: *
- guzzlehttp/guzzle: ^6|^7
- votong/cloudflare-bypass: ^1.0.0
Requires (Dev)
- phploc/phploc: ^5.0
- phpmd/phpmd: ^2.4
- phpunit/phpunit: ^8|^9|^10|^11
- sebastian/phpcpd: ^4.0
- squizlabs/php_codesniffer: ^3.2
This package is not auto-updated.
Last update: 2024-09-18 18:24:24 UTC
README
Guzzle Cloudflare 绕过
重要提示:由于 KyranRana 的依赖实际上已经不再维护(https://github.com/KyranRana/cloudflare-bypass/commit/00d34f0050b817b858bbf5fd349b9911932f353f),此包可能不会像之前那样好。感谢您的理解。请查看我的其他作品(https://github.com/votong | https://twitch.tv/cursedware | https://patreon.com/votong | https://discord.gg/ujjrPCu | https://votong.me)
绕过 Cloudflare DDoS 保护 - 请谨慎使用
此包基于 KyranRana 的 cloudflare-bypass。
安装
使用 composer
用法
composer require votong/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!!