<?php
/**
File: composer.json
{
"require": {
"paquettg/php-html-parser": "v2.0.2"
}
}
*/
require "vendor/autoload.php";
use PHPHtmlParser\Dom;
$site = "http://site.com";
$icerik = file_get_contents($site);
$icerik = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $icerik);
$icerik = preg_replace('#<div id="Logo"(.*?)>(.*?)</div>#is', '', $icerik);
$dom = new Dom;
$dom->load($icerik);
$contents = $dom->find('.OranSatirF');
foreach ($contents as $key => $content)
{
if($key === 0)
continue;
$html = $content->innerHtml;
preg_match_all('#<div[^>]*>(.*?)</div>#', $html, $matches);
$result = array_map('strip_tags', $matches[1]);
print_r($result);
exit;
}
/**
Output:
Array
(
[0] => Beyaz Rusya-Beyaz Rusya Premier Ligi
[1] => Cum, 18:45
[2] => Dniapro-MHZ
[3] =>
[4] => 2.30
[5] => 2.27
[6] => 3.05
[7] => 3.10
[8] => 2.85
[9] => 2.85
[10] =>
[11] => Energetik-BGU M
)
*/
?>