Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('simple_html_dom.php');
- $html = file_get_html('https://mkb10.su/F10-F19.html');
- $data =[];
- $i = 0;
- foreach($html->find('ol.tm-list-additional-space li') as $element) {
- $data[$i] = [
- 'code' => $element->find('span', 0)->plaintext,
- 'name' => $element->find('a', 0)->plaintext,
- ];
- $htmlT = file_get_html('https://mkb10.su/'.$element->find('a', 0)->href);
- foreach($htmlT->find('ol.tm-list-additional-space li') as $e) {
- $data[$i]['sub'][] = [
- 'code' => $e->find('span', 0)->plaintext,
- 'name' => $e->find('a', 0)->plaintext,
- ];
- }
- $i++;
- }
- echo json_encode($data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement