Теперь создадим файл composer.json
{ "require": { "jonnyw/php-phantomjs": "3.*", "symfony/dom-crawler": "3.*", "symfony/css-selector": "3.*" }, "config": { "bin-dir": "bin" }, "scripts": { "post-install-cmd": [ "PhantomInstaller\\Installer::installPhantomJS" ], "post-update-cmd": [ "PhantomInstaller\\Installer::installPhantomJS" ] } }Скачаем все зависимости
php composer.phar installНу и сам парсинг index.php
<?php require __DIR__ . '/vendor/autoload.php'; $client = \JonnyW\PhantomJs\Client::getInstance(); $request = $client->getMessageFactory()->createRequest('http://superdeals.aliexpress.com/en?spm=2114.11010108.21.1.v65LIL', 'GET'); $response = $client->getMessageFactory()->createResponse(); $client->send($request, $response); $html = $response->getContent(); $crawler = new \Symfony\Component\DomCrawler\Crawler($html); $div = $crawler->filter('div.pro-msg'); if($div) { echo $div->first()->text(); }Если выполнить php index.php можно увидеть, что фантом скачал страницу и выполнил javascript код
Today Only Boy's Coat > Synthetic leather> Motor jacket style> Available in black and red share: vk pinterest facebook Twinner Google+ Email Sign in and share the website for a chance to get Points, which you can then convert to coupons. US $9.74 US $32.48 / piece | 70% Off 0486Left Buy Now