I'm trying to strip out a string, which occurs only once on a page obtained using cURL. Example:
<h3 class=" ">STRING IN QUESTION</h3>
or
<h3 class="active">STRING IN QUESTION</h3>
or
<h3 class=" active">STRING IN QUESTION</h3>
I would like to do this using preg_match, unless it can be accomplished with a less resource-intensive method.
Here is the regex I'm using, which is producing zero results:
<h3\sclass="\s">(.*?)</h3>
EDIT:
Here is the actual code (an actual URL used here in place of dynamic one) -- discovered that when pulled via cURL, the class attribute does not exist, but still does not work as shown:
$ch = curl_init ("URL IN QUESTION");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);
preg_match('<h3>(.*?)</h3>', $page, $match);
print_r($match);
Prints Nothing