Your problem is in the regular expression.
You are looking for <head>
, but the given example's website has a <head profile="http://gmpg.org/xfn/11">
.
Replace your regular expression with :
$curl_scraped_page = preg_replace("/<head.*>/i", "<head><base href='$url' />", $curl_scraped_page, 1);