Get meta tags from url, php function example:
function get_meta_tags ($url){
$html = load_content ($url,false,"");
print_r ($html);
preg_match_all ("/<title>(.*)<\/title>/", $html["content"], $title);
preg_match_all ("/<meta name=\"description\" content=\"(.*)\"\/>/i", $html["content"], $description);
preg_match_all ("/<meta name=\"keywords\" content=\"(.*)\"\/>/i", $html["content"], $keywords);
$res["content"] = @array("title" => $title[1][0], "descritpion" => $description[1][0], "keywords" => $keywords[1][0]);
$res["msg"] = $html["msg"];
return $res;
}
Example:$html = load_content ($url,false,"");
print_r ($html);
preg_match_all ("/<title>(.*)<\/title>/", $html["content"], $title);
preg_match_all ("/<meta name=\"description\" content=\"(.*)\"\/>/i", $html["content"], $description);
preg_match_all ("/<meta name=\"keywords\" content=\"(.*)\"\/>/i", $html["content"], $keywords);
$res["content"] = @array("title" => $title[1][0], "descritpion" => $description[1][0], "keywords" => $keywords[1][0]);
$res["msg"] = $html["msg"];
return $res;
}
print_r (get_meta_tags ("bing.com") );
Комментариев нет:
Отправить комментарий