M
M
MaxFreedom2020-09-02 17:24:08
PHP
MaxFreedom, 2020-09-02 17:24:08

I can't get data from a specific site using SimpleDomHTML PHP, but what's wrong?

Friends, hello! There is a small problem with getting data from the site. In general, I open any site, except for this " https://investmint.ru/ ", I use simplehtmldom. You can try this code, suggest a way to get at least any data from this page, just for the sake of interest, you want to understand what is wrong and get the result.


include("simplehtmldom/simple_html_dom.php");
$url = " https://investmint.ru/ ";
//create a DOM object
$html = new simple_html_dom();
$html->load_file($url);
echo $html;


I get a blank page ((What's wrong? But any other site except "investmint.ru" opens with this code. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2020-09-02
@RomanticOS

Bot Protection

spoiler
<html>
  <head>
    <script>
      function set_cookie () {
        var now = new Date()
        var time = now.getTime()
        time += 19360000 * 1000
        now.setTime(time)
        document.cookie = 'beget=begetok' + '; expires=' + now.toGMTString() + '; path=/'
      }
      set_cookie()
      location.reload()
    </script>
  </head>
  <body>
  </body>
</html>

That is, a cookie is set and the page reloads. The server checks for the cookie and returns the full page.

D
Darkhan Kamaliev, 2020-09-02
@darakanoit

Perhaps the site is drawn using JS, then through php you will not be able to see it (php does not play js), you need something like "headless chrome selenium" (headless chrome), smoke in this direction.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question