votong/cloudflare-bypass
Composer 安装命令:
composer require votong/cloudflare-bypass
包简介
A library for helping bypass the cloudflare UAM page.
README 文档
README
Unfortunately these new changes which Cloudflare are implementing will not be feasible to implement nor maintain in PHP. So it saddens me to say this project is going to be archived. Well played Cloudflare.
Cloudflare Bypass
A new and improved PHP library which bypasses the Cloudflare IUAM page using cURL.
Installation
With composer:
composer require votong/cloudflare-bypass
Usage with cURL
Use cURL how you normally would but instead of using curl_exec to execute the
request we provide a class called CFCurlImpl. CFCurlImpl provides an exec method which takes your cURL handle and
executes it - handling the IUAM page if it appears.
Method definition:
CFCurlImpl->exec(resource $curlHandle, UAMOptions $uamOptions)
Example:
<?php use CloudflareBypass\CFCurlImpl; use CloudflareBypass\Model\UAMOptions; /* * Prerequisites * * Set the following request headers: * * - Upgrade-Insecure-Requests * - User-Agent * - Accept * - Accept-Language * * Set the following options: * * - CURLINFO_HEADER_OUT true * - CURLOPT_VERBOSE false * */ $url = "https://predb.me/?search=720p"; $ch = curl_init($url); // Want to cache clearance cookies ? //curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); //curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Upgrade-Insecure-Requests: 1", "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "Accept-Language: en-US,en;q=0.9" )); $cfCurl = new CFCurlImpl(); $cfOptions = new UAMOptions(); $cfOptions->setVerbose(true); // $cfOptions->setDelay(5); try { $page = $cfCurl->exec($ch, $cfOptions); // Want to get clearance cookies ? //$cookies = curl_getinfo($ch, CURLINFO_COOKIELIST); } catch (ErrorException $ex) { echo "Unknown error -> " . $ex->getMessage(); }
votong/cloudflare-bypass 适用场景与选型建议
votong/cloudflare-bypass 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 136 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 votong/cloudflare-bypass 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 votong/cloudflare-bypass 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 136
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-24