Hey,
I'm trying to use preg_match_all to store all instances of video popups from cnn.com, and having some difficulty. I want to get all string that match this:
<a href="javascript:cnnVideo('play', ' (anything here) ')"> (anything here) </a>
but it doesn't seem to be working.
i want to save each component of the expression as well, so i surrounded each in parenthesis..
here's my code: thanks a lot.
$ch = curl_init("http://www.cnn.com/video/");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$code = curl_exec($ch);
curl_close($ch);
preg_match_all("/ (<a href=\"javascript:cnnVideo\('play', ') (.*) ('\)\">) (.*) (</a>) /s", $code, $matches, PREG_SET_ORDER);
echo $matches[0]; //etc..