A
A
animr2019-05-17 12:20:13
PHP
animr, 2019-05-17 12:20:13

Why does it throw an error on an existing page when parsing curl?

Guys who encountered the following problem when parsing a CURL page:
Parsing the trace. page: zakupki.gov.ru/epz/order/quicksearch/search.html
Sends headers:
HTTP/1.1 404 Not Found Server: nginx Date: Fri, 17 May 2019 09:05:45 GMT Content-Type: text/html Content -Length: 2036 Connection: close Vary: Accept-Encoding ETag: "4fe9e070-7f4".
Who can help? Here is the connection code:

$url_pars = 'http://zakupki.gov.ru/epz/order/quicksearch/search.html';
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url_pars);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        //curl_setopt($ch, CURLOPT_NOBODY, true);
        curl_exec($ch);
        curl_close($ch);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lazy @BojackHorseman PHP, 2019-05-17
@animr

some sort of bot protection? try to feed him all the required headers, pretend to be a browser

E
Evgeny Nikolaev, 2019-05-17
@nikolaevevge

Most likely, not all the headers you send are necessary so that the server does not consider you a robot or something else.
Try my curlpro.ivru.net library and download it to the curlPro.php file
Then require_once("curlPro.php");// specifying the directory where you put
$cp = new curlPro();
$cp->newip("zakupki.gov.ru");// for your case
$cp->newuri("/epz/order/quicksearch/search.html");// also for your case
$text = $cp->go();// Parsing object here
$text = $text->val();// Get rid of object parsing, get text value
var_dump($text);// or echo see html page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question