Here's what I have so far:
Code: Select all
<?php
$data = file_get_contents('http://www.mywebsite.com/');
preg_match_all ("/<div class=\"main\">([^`]*?)<\/div>/", $data, $matches);
//testing the array $matches
echo sizeof($matches);
echo sprintf('<pre>%s</pre>', print_r($matches, true));
?>
2
Array
(
[0] => Array
(
)
[1] => Array
(
)
)
It's creating a 2d array in $matches, which is excellent, but $matches[0] and [1] contain no data. I'm assuming that something is wrong with the regex in the preg_match_all but I'm not extremely familiar with regular expressions so that might not be it. I know it's getting the HTML code just fine, because if I echo $data it shows the contents of mywebsite.
Thanks