获取数据byc url,从访问的url下载javascpirt as xhr

我正尝试从(https)://example.com/page/获取数据,并使用javascript从(https)://example.com/page/details下载其他数据。 所以,通过curl我从第一个网址获取数据,但没有来自第二个网址的数据。 另外,如果我尝试从第2个网址获取数据,则会返回第1个网址的simiral数据。

请求标题(2个不同):

$headers[] = array('Host: https://example.com/page/details',
    'User-Agent: установлен',
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
    'Accept-Encoding: gzip, deflate, br',
    'DNT: 1',
    'Upgrade-Insecure-Requests: 1');
    // $headers[] = array('Host: https://example.com/page/details',
    // 'Accept: */*',
    // 'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
    // 'X-CSRFToken: установлен',
    // 'X-Requested-With: XMLHttpRequest',
    // 'Referer: https://example.com/page/',
    // 'DNT: 1',
    // 'If-None-Match: "установлен"',
    // 'Connection: keep-alive',
    // 'Pragma: no-cache',
    // 'Cache-Control: no-cache');

我的代码:

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 60 );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers[$i]);

浏览器通过第2个url获得正确数据时的响应头(没有Connection:keep-alive)。 连接中断,第二个url重新加载了禁用的js。

Content-Length: 10813
Content-Type: text/html; charset=utf-8
Date: 
Etag: "[a-z0-9]+"
Public-Key-Pins: max-age=5184000; includeSubDomains; pin-sha256="страшная абракадабра"; pin-sha256="и тут тоже"
Server: nginx
Strict-Transport-Security: max-age=31536000
Vary: User-Agent
X-Content-Type-Options: nosniff
content-security-policy: script-src https://ssl.google-analytics.com/ga.js https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ https://addons.cdn.mozilla.net; style-src 'self' 'unsafe-inline' https://addons.cdn.mozilla.net; default-src 'self'; frame-src 'self' https://www.google.com/recaptcha/; child-src 'self' https://www.google.com/recaptcha/; img-src 'self' data: blob: https://ssl.google-analytics.com https://addons.cdn.mozilla.net https://static.addons.mozilla.net https://sentry.prod.mozaws.net; media-src https://videos.cdn.mozilla.net; object-src 'none'; connect-src 'self' https://sentry.prod.mozaws.net; font-src 'self' https://addons.cdn.mozilla.net; form-action 'self' https://developer.mozilla.org; base-uri 'self' https://addons.mozilla.org; report-uri /__cspreport__
x-frame-options: DENY
x-xss-protection: 1; mode=block

需要修复哪些信息才能获取正确的数据?

链接地址: http://www.djcxy.com/p/87307.html

上一篇: Get data byc url that downloads javascpirt as xhr from visited url

下一篇: PHP cURL: modify/overwrite Connection header