0

Пытаюсь получить данные со страницы - https://www.dell.com/support/home/en-us/product-support/servicetag/0-bDl5ZWJWM2dLZzNtaTQyL3ZXeGhtUT090/product

Делаю это так:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.dell.com/support/home/en-us/product-support/servicetag/0-bDl5ZWJWM2dLZzNtaTQyL3ZXeGhtUT090/product");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //curl_setopt($ch, CURLOPT_HTTPGET, 1);
    
    $headers = array();
    $headers[] = "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";
    $headers[] = "accept-encoding: gzip, deflate, br";
    $headers[] = "accept-language: ru,pl-PL;q=0.9,pl;q=0.8,en-US;q=0.7,en;q=0.6";
    $headers[] = 'cookie: DellCEMSession=3F3B543F68FDAAB6BE1FE81DED3E1A70; dell_canary=live; eSupId=SID=9d1a42be-9ff8-455d-9e54-d4f062313909&ld=20210916; AMCVS_4DD80861515CAB990A490D45%40AdobeOrg=1; s_ecid=MCMID%7C91500928481571826250508882865371581546; rumCki=false; cidlid=%3A%3A; s_cc=true; _cls_v=a2f5c0fd-15d1-44ac-8e5a-29bdbe4ad757; _cls_s=851976fa-b756-4680-a406-259e96a6173d:0; ipe_s=6997d697-588b-4082-f11a-f8dbb71cef12; TLGUID=91500928481571826250508882865371581546; _evidon_consent_cookie={"consent_date":"2021-03-16T14:01:28.160Z","categories":{"15":true},"vendors":{"15":{"36":true,"41":true,"131":true,"168":true,"242":true,"249":true,"348":true,"395":true,"635":true,"683":true,"728":true}},"cookies":{"15":true},"consent_type":1}; lwp=c=us&l=en&cs=04&s=bsd; IPE120994=IPE120994; OLRProduct=OLRProduct=10VNP52|; s_sq=%5B%5BB%5D%5D; AKA_A2=A; bm_sz=419BA3B1F24E0F49622FC06CD8FB77ED~YAAQF/lVaPs+RTh4AQAAWW/qSgufnhuuxya8R8u76VEJCzP34Y6jYyz+KtwvGP9irLGi7/6HJsAch6+KrfbidfX2SyVLr8kpOZhXd2eIDYeCPwnKnyaQKSbeRxCRk6pI8knoZ/dZAgQvYQSpJN6aL+mJXmdE3+B2rqRt6WMBPrQ0g/ka68EsnpG1ipkKMA==; AMCV_4DD80861515CAB990A490D45%40AdobeOrg=1585540135%7CMCIDTS%7C18706%7CMCMID%7C91500928481571826250508882865371581546%7CMCAAMLH-1616769381%7C6%7CMCAAMB-1616769381%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1616171781s%7CNONE%7CMCAID%7CNONE%7CvVersion%7C4.4.0; ak_bmsc=5CBA93F8D02D0F475E00C30BA7D1967C6855F9170F0E0000E5B65460947F0A53~plLOmK12bz/JY2aWX372doGwJH2F3h1GTfYwptItqUXbL7AVOIHMdjlEpQjmislqSUObKXRbGXH6pFbeW4z16pp40dkeXi7Tb5ib06C3LOJJNV1HH1+GbkQosTREPzFxd/fy65HSn2HPzDNmD7FvDCyStlVawjoDPW1/DjlBe6Y4ripkr2RURPSdRErf36TDYKOwjs9mAb5zCh1+/vVniOgH32WoeRRP0iNXYaz/mnasLoR1GBKJBvkAZBPTe6xdDR; bm_mi=085CE0B490985831D1D4223A3A598015~ABMbaJ4yuvEwkEPxIGwjxzHVqZAV4NYqn57As5O6tVTEuwLUFXZeGEkdBdzr+Jb5mDzLlBN+5ggDXb4y/jieu4uFtnXLI2F6zvMeYdZ1eiXILOzxTcCmFk9wsfariEYRZjlJz9s6ug/Eo+v+4h1jLy52mf0drVCA7lFavQovi2muW+oL5KcXG8HzIKz+TO0YycTL28+m8ViKp2QkqRYT+AN8RFY1/G9/sm9qe7FA8O85OqnuNfjdf8xzkUSQdOCTWrEF4QJJA3cJ1IQFegnoCQ==; s_vnc365=1647700582113%26vn%3D3; s_ivc=true; ipe.184.pageViewedDay=78; s_c49=c%3Dus%26l%3Den%26s%3Dbsd%26cs%3D04%26servicetag%3D10vnp52%26systemid%3Dinspiron-15-3542-laptop; gpv_pn=us%7Cen%7C04%7Cbsd%7Cesupport-productsupport%7Cproduct-support%7Cservicetag; s_depth=2; ipe.184.pageViewedCount=4; s_ips=969; _abck=C92076A37145E4DEE430CBD556FE1F76~0~YAAQFPlVaLijkkR4AQAALer8SgUh4iFm25z/YZ6vzxDhPhrGdEPFHx3XN5kiKmnJmLtIne+AjKjkuabZxS0znc95+C8mA08ySNWKs8CF70iQedQTOL4efjFOnJLxqsyFUWcUnthh8qQrULljDkfD9FJMhBWCHUw5wEVLMFJwhMEyJ1UoarRBcyIAndpuA4ucNHLMwbQCFxZsv0oMg8bb+BdoKXHCpTc6MH8X4mU2U6rDn37g8CSSKqKoQ298P7IJ5e9S3xBrCNfhS5WcWJ+5MnALeKSdRFFwldJ5SK6DO555I0dJAFDn1zV73mtEqYZ8nPSqBiwcgRC87iDA/qhtpq8FI/KkgmO29Rqq6qx5sQgqr+rMSdijHyex3mu2ZT6GnESxycJG0o4tzvYhFas0W+mnfcV0pw==~-1~-1~-1; s_tp=2049; s_ppv=us%257Cen%257C04%257Cbsd%257Cesupport-productsupport%257Cproduct-support%257Cservicetag%2C47%2C47%2C969%2C1%2C2; akavpau_maintenance_vp=1616166094~id=1596de31e2962a6f337aad2f268971f1; bm_sv=B01270CC046FBF41F012992250E001F2~o63Ab851a1jdlyWlNtWchNEH+CGWk5nUYyzCfP7Sx/N0esBKrG8SZEqh2dB3zncdMDtTGjxiHVGhLT7w1rSuaChH7SerG2qFVeF2EjmjZL/O41BCIYJj5HywFy9KGGafcwk63qLFlVYt7fgmYYtac35tKOJjFp+yR297q7EDLuM=; ipe_184_fov=%7B%22numberOfVisits%22%3A2%2C%22sessionId%22%3A%226997d697-588b-4082-f11a-f8dbb71cef12%22%2C%22expiry%22%3A%222021-04-15T13%3A01%3A21.863Z%22%2C%22lastVisit%22%3A%222021-03-19T14%3A56%3A34.178Z%22%7D; RT="z=1&dm=dell.com&si=60a3f0f0-7810-4819-ac31-4f8fa9eb1a10&ss=kmgenv58&sl=c&tt=bnu&ld=pzz3&ul=sh1a';
    $headers[] = 'sec-ch-ua: "Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"
        sec-ch-ua-mobile: ?0
        sec-fetch-dest: document
        sec-fetch-mode: navigate
        sec-fetch-site: none
        sec-fetch-user: ?1
        upgrade-insecure-requests: 1';
        
    //$headers[] = "Referer: https://www.dell.com/support/home/en-us?app=products";

    $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36";
    
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    $result = curl_exec($ch);

    var_dump($result);

В результате получаю страницу с непонятными символами-иероглифами. Подскажите, что не так делаю?

Большое спасибо за помощь!

1 ответ 1

0

Уже нашел решение проблемы. Добавил строку:

curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');

Все работает :)

Ваш ответ

Нажимая «Отправить ответ», вы соглашаетесь с условиями пользования и подтверждаете, что прочитали политику конфиденциальности.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.