forked from KyranRana/cloudflare-bypass
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.php
executable file
·31 lines (26 loc) · 1.03 KB
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
ini_set('display_errors', 1);
require_once 'libraries/httpProxyClass.php';
require_once 'libraries/cloudflareClass.php';
$httpProxy = new httpProxy();
$httpProxyUA = 'proxyFactory';
$requestLink = 'https://coinkite.com/';
$requestPage = json_decode($httpProxy->performRequest($requestLink));
// if page is protected by cloudflare
if($requestPage->status->http_code == 503) {
// Make this the same user agent you use for other cURL requests in your app
cloudflare::useUserAgent($httpProxyUA);
// attempt to get clearance cookie
if($clearanceCookie = cloudflare::bypass($requestLink)) {
// use clearance cookie to bypass page
$requestPage = $httpProxy->performRequest($requestLink, 'GET', null, array(
'cookies' => $clearanceCookie
));
// return real page content for site
$requestPage = json_decode($requestPage);
echo $requestPage->content;
} else {
// could not fetch clearance cookie
echo 'Could not fetch CloudFlare clearance cookie (most likely due to excessive requests)';
}
}