Hi
I've been trying to understnad preg for a while now and don't know where I am going wrong with this:
Thanks
I've been trying to understnad preg for a while now and don't know where I am going wrong with this:
PHP:
<?php
function getweb($website)
{
if(!$ch = curl_init($website)) {
echo "Could not connect to $website";
return;
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close ($ch);
return $output;
}
$total = getweb('http://www.thewebmasterstool.com/');
$match_expression = '/<title>(.*?)\/<\/title>/i';
preg_match($match_expression,$total,$matches);
$asd = strip_tags($matches[1]);
echo $asd;
?>
Thanks






