Incerc sa preiau date dintr-un cod, a unei pagini (mainFrame.cgi), mai exact vreau sa preiau doar numarul generat Total: 11162.
Imi returneaza urmatoarea eroare:
Cod: Selectaţi tot
Warning: preg_match(): Unknown modifier '(' in C:\xampp\htdocs\index.php on line 16
Not found
Cod: Selectaţi tot
$regex = '<title>(.*?)<\/title>/s';
Fragment html (daca este nevoie am sa il trimit tot):
Cod: Selectaţi tot
<tbody><tr class="staticProp"><td nowrap=""><img src="/images/settingBullet.gif" alt="" title=""></td><td nowrap="" align="left">Total</td><td nowrap="">:</td><td nowrap="">11162</td><td></td></tr></tbody>
Cod: Selectaţi tot
<?php
$curl = curl_init('http://192.168.1.151/web/guest/en/websys/webArch/mainFrame.cgi');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($curl);
if(curl_errno($curl)) // check for execution errors
{
echo 'Scraper error: ' . curl_error($curl);
exit;
}
curl_close($curl);
$regex = '<tr class="staticProp">(.*?)<\/tr>/s';
if ( preg_match($regex, $page, $list) )
echo $list;
else
print "Not found";
?>