Last active
November 17, 2017 00:41
-
-
Save spacebit-official/1966107eac0f4355bde3c41e417effb1 to your computer and use it in GitHub Desktop.
simple_html_dom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
use Sunra\PhpSimple\HtmlDomParser; | |
$html = curl_get('https://ntschool.ru/kursyi'); | |
$dom = HtmlDomParser::str_get_html($html); | |
$courses = $dom->find('.courses-list--item-body'); | |
foreach ($courses as $course) { | |
$a = $course->find('a',0); // 0 это самый первый по счету в $course | |
$inner = curl_get('https://ntschool.ru/' . $a->href); | |
$dominner = HtmlDomParser::str_get_html($inner); | |
$cost = $dominner->find('.course1-ticket1--box-newPrice',0); | |
echo $a->plaintext,': ',$cost->plaintext . '<br>'; | |
//break; | |
} | |
//$foo->find('.pattern')->next_sibling()->find('.pattern'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment