How to simulate the browser with curl on aliexpress?

How to simulate curl using a normal browser user?
I have nacheral code
<?php
$cs = curl_init();
 $opt = array(CURLOPT_URL = -- > 'https://ru.aliexpress.com/category/202003409/tops-tees.html?site=rus&g=y&SortType=total_tranpro_desc&needQuery=n&tag=',
 CURLOPT_COOKIE => ",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_HEADER => 0,
 CURLOPT_COOKIESESSION => true,
 CURLOPT_COOKIEFILE => $_SERVER['DOCUMENT_ROOT'].'/cookie.txt',
 CURLOPT_REFERER => null,
 CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36",
 CURLOPT_TIMEOUT => 10,
 CURLOPT_RETURNTRANSFER => 1,
 CURLOPT_FOLLOWLOCATION => 1,
);
 curl_setopt_array($cs, $opt);
 $out = curl_exec($cs);
 echo $out;
curl_close($cs);
?>

But after the fifth to seventh run, Ali starts to forward to the login page. Helps to change ip or just wait. But for the parser this is not necessary)
In the file cookie.txt are cookies I pulled from the browser.
There may be an error there, because I never found the normal manual describing what should be in that file.
55deac9e7de44e48af2b9b721132301b.png
July 2nd 19 at 13:16
3 answers
July 2nd 19 at 13:18
1. The browser can simulate only the headless browsers such as PhantomJS or CasperJS
2. Substitute cookies is wrong, use an additional the CURLOPT_COOKIEJAR Directive with the same value of $_SERVER['DOCUMENT_ROOT'].'/cookie.txt'
3. CURLOPT_COOKIE but in your case it is necessary to remove.
4. the curl good at parsing simple websites that have no protection from parsing. So in the case of Aliexpress suggest to watch all the paragraph 1.
July 2nd 19 at 13:20
Try to parse the mobile version of the site.
Can try to access the API?
NightmareJS handy thing to emulate a browser and parsing of the website.
July 2nd 19 at 13:22
open the console, see what the browser sends and send the same data

Find more questions by tags PHPWeb Development