Hallo!
I capture web page and store info in my site. Its working good, but I have some wrong problem...
Here is a code were catch up remote url:
<?php
$url = "http://www.example.com";
$data = implode("", file($url));
// Get content items
preg_match_all ("/<div align=\"center\">([']*?)<\/div>/", $data, $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
echo $val[0] . "\n";
}
?>
This code get content from remote site and output it in my site.
But ..... The page look like this:
<div align="center">
some html ......
</div>
<div align="center">
some html who I want......
</div>
<div align="center">
some html ......
</div>
I getting all contents from <div></div> tags!!
I want get contents between middle div tags.
How can I modify code above with preg_match_all () correctly?
Thanx!