A
A
Alex Ivanov2019-07-22 18:04:20
PHP
Alex Ivanov, 2019-07-22 18:04:20

Why does the Cloudflare stub drop out when parsing?

It was necessary to pull off the headers from the site, but instead of content, parsing on KURL gets Clara's stub
5d35cfbb34d82883043800.png
. Although when you open it with a browser, everything opens without it.
Curl code that should open the page

$url=$_GET['url'];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, '1');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$text = curl_exec($ch);

How to bypass it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
fvckdeadline, 2019-07-28
@Protossan

There is a python library - Cloudflare-scraper
https://github.com/Anorov/cloudflare-scrape
Works great with Cloudflare protection.
Perhaps there is something similar in php ...

R
Renat, 2019-07-26
@RenatKZ

imitate a complete browser, store cookies and pass them on connection

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question