Answer the question
In order to leave comments, you need to log in
PHP - How to parse data after loading js scripts?
Good day to all! There was a problem with parsing this site: https://cloud.sigma.ru/login The fact is that the data is loaded here in 2 stages. More precisely, first some scripts, then the second. I tried almost everything: regular curl (I even wrote headers manually - perhaps incorrectly), simple_html_dom, phpQuery. As a result, I came to the implementation: Selenium WebDriver + PhantomJS , BUT, I managed to load only 1 stage of loading, but it's better than using curl and others. I think that you need to somehow insert into PHP a call to these js scripts that are being loaded. But I don't know how to do it because I'm new to it. I will be glad for any help.
Code that does 1 step:
<?php
//selenium php WebDriver
require_once('vendor/autoload.php');
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\WebDriverExpectedCondition;
$web_driver = RemoteWebDriver::create(
"http://localhost:8910/wd/hub",DesiredCapabilities::firefox()
//array("platform"=>"LINUX", "browserName" => "firefox", "version" => "71"), 920000
);
$web_driver->get("https://cloud.sigma.ru/login");
//sleep(30);
$html = $web_driver->getPageSource();
echo $html;
Answer the question
In order to leave comments, you need to log in
If the data is loaded by scripts, then you will not catch it through PHP. Parse with JS.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question