jaymoulin / guzzlehttp-cloudflare
该包已被废弃且不再维护。未建议替代包。
使用GuzzleHTTP绕过Cloudflare保护
1.1.1
2020-03-22 15:53 UTC
Requires
- php: ^7.2
- ext-bcmath: *
- ext-curl: *
- guzzlehttp/guzzle: ^6.3
- jaymoulin/cloudflare-bypass: ^3.3.1
Requires (Dev)
- phploc/phploc: ^5.0
- phpmd/phpmd: ^2.4
- phpunit/phpunit: ^8.0
- sebastian/phpcpd: ^4.0
- squizlabs/php_codesniffer: ^3.2
README
Guzzle Cloudflare Bypass
(此产品在免费和宽松的许可证下可用,但需要财务支持以维持其持续改进。除了维护和稳定性外,还有许多期望添加的功能。)
重要提示:由于KyranRana的依赖项已经不再维护(https://github.com/KyranRana/cloudflare-bypass/commit/00d34f0050b817b858bbf5fd349b9911932f353f),此包可能不会表现良好。感谢您的理解。请查看我的其他作品(https://github.com/jaymoulin | https://twitch.tv/cursedware | https://patreon.com/jaymoulin | https://discord.gg/ujjrPCu | https://jaymoulin.me)
绕过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!!