这是一个开始
// Your crawler was sent to this page.
$url = 'http://example.com/page';
// Example of a relative link of the page above.
$relative = '/hello/index.php';
// Parse the URL the crawler was sent to.
$url = parse_url($url);
if(FALSE === filter_var($relative, FILTER_VALIDATE_URL))
{
// If the link isn't a valid URL then assume it's relative and
// construct an absolute URL.
print $url['scheme'].'://'.$url['host'].'/'.ltrim($relative, '/');
}
查看http_build_url方法作为创建绝对锚点的另一种方法.