My goal here is to load a remote page (using cURL) then get ONLY the data between a <p> and </p> and turn it into an array. The page only has one <p></p> in it. The problem here is that it well... just won't work!
heres my code:
When i preg_replace the original $a, the code outputs the 'asdfasdf' and 'whatever between tags' and thats it. When i use the preg_replace with the $file_contents, it doesn't really do anything at all (outputes the entire page). If there are alternate methods to get what i want accomplished, i would LOVE to hear about them.
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, 'http://www.site.com/ex.php?var=ex');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
//$a='asdfasdf <p> whatever between tags </p> fdsgfg';
$a = $file_contents;