Giter VIP home page Giter VIP logo

cfscrape's Introduction

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.

cfscrape's People

Contributors

klgd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.