I want to curl a page and extract data between a div tag
<div class="topmasters" align="center"> data required </div>
here is my code
Please help to spot the error in the code?
<div class="topmasters" align="center"> data required </div>
here is my code
Code:
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "[URL unfurl="true"]http://example.com/");[/URL]
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// grab URL, and return output
$output = curl_exec($ch);
// close curl resource, and free up system resources
curl_close($ch);
preg_match_all('/<div\s class=\'topmasters\' \s align=\'center\'>(.*?)<\/div>/",$output, $t);
$output=str_replace('/<div\s class=\'topmasters\' \s align=\'center\'>','',$t[0]);
echo $output;
?>
Please help to spot the error in the code?