Skip to content

Instantly share code, notes, and snippets.

@spacebit-official
Last active November 17, 2017 00:41
Show Gist options
  • Save spacebit-official/1966107eac0f4355bde3c41e417effb1 to your computer and use it in GitHub Desktop.
Save spacebit-official/1966107eac0f4355bde3c41e417effb1 to your computer and use it in GitHub Desktop.
simple_html_dom
<?
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