S
S
siroper2022-03-05 21:21:49
Disassembler
siroper, 2022-03-05 21:21:49

How to get data, download a page from Leroy?

Hello. I'm trying to get data from the Leroy website, but nothing comes out, just a white screen. How many methods just did not try. The code is like this:

$get_cookie_page = 'https://samara.leroymerlin.ru/catalogue/kuhonnye-smesiteli/';
echo curl_download($get_cookie_page);

function curl_download($Url){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $Url);
  curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookie.txt');
  $http_headers = array(
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 OPR/84.0.4316.21',
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Accept-Encoding: gzip, deflate, br',
    'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
    'Cache-Control: max-age=0',
    'Referer: https://leroymerlin.ru/',
    'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Opera";v="84"',
    'sec-ch-ua-mobile: ?0',
    'sec-ch-ua-platform: "Windows"',
    'sec-fetch-dest: document',
    'sec-fetch-mode: navigate',
    'sec-fetch-site: same-origin',
    'sec-fetch-user: ?1',
    'upgrade-insecure-requests: 1'
  );
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  $output = curl_exec($ch);
  curl_close($ch);
  return $output;
}


Please tell me how to solve the issue?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
D', 2016-04-27
@Denormalization

99% that this is a modifier for printf and other analogues.
Something like sprintf("STCFTF#%s#\n", my_string);

A
Alexey, 2016-04-27
@alsopub

Most likely, some parameter - a string - will be substituted here during the output.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question