Skip to content

A simple PHP module to bypass Cloudflare's anti-bot page (also known as "I'm Under Attack Mode", or IUAM)

License

Notifications You must be signed in to change notification settings

ScoLib/cfscrape

Repository files navigation

Cloudflare Scrape

Latest Version on Packagist Software License Build Status Total Downloads

A simple PHP module to bypass Cloudflare's anti-bot page (also known as "I'm Under Attack Mode", or IUAM)

Thanks https://github.com/Anorov/cloudflare-scrape

依赖

php >= 7.2

v8js扩展 https://github.com/phpv8/v8js

安装

$ composer require cfscrape/cfscrape

使用

获取响应

$scraper = \Cfscrape\Cfscrape::createScraper();
// 延时
$scraper->setDelay(10);
// 自定义UA
$scraper->setUserAgent('custom-ua');
// \Psr\Http\Message\ResponseInterface
$response = $scraper->get('http://somesite.com');

获取Cookie

// cookies is array
// [
//     'cf_clearance' => 'c8f913c707b818b47aa328d81cab57c349b1eee5-1426733163-3600',
//     '__cfduid' => 'dd8ec03dfdbcb8c2ea63e920f1335c1001426733158'
// ]
[$cookies, $userAgent] = \Cfscrape\Cfscrape::getTokens('http://somesite.com');

// cookies is string
// cf_clearance=c8f913c707b818b47aa328d81cab57c349b1eee5-1426733163-3600; __cfduid=dd8ec03dfdbcb8c2ea63e920f1335c1001426733158
[$cookies, $userAgent] = \Cfscrape\Cfscrape::getCookieString('http://somesite.com');

License

The MIT License (MIT). Please see License File for more information.

About

A simple PHP module to bypass Cloudflare's anti-bot page (also known as "I'm Under Attack Mode", or IUAM)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages