<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once ('../includes/connect.php');
try {
$filter = $db->query("SELECT * FROM procesory");
$check = $filter->rowCount();
echo $check.'<br />';
while($c = $filter->fetch()){
//print_r($c[21].'<br/>');
$source = file_get_contents($c['pURLMorele']);
$doc = new DomDocument();
$file = @$doc->loadHTML($source);
$rows = $doc->getElementsByTagName('span');
foreach ($rows as $row) {
if($row->getAttribute('class') == 'price') {
echo $c['ID'].' - ';
echo $row->nodeValue.' -- OK!<br />';
}
}
}
}
catch (PDOException $e) {
echo 'Something went wrong!<br>'.$e->getMessage();
die();
}
?>
Hello :) I need to get from my database from each record "pURLMorele" column, then extract from that URL text between SPAN with class "price", but now it works only from ID 2 to 4, it's skipping first record. Why is that?