How to get content of the meta tag of a webpage

江枫思渺然 提交于 2019-12-25 01:00:43

问题


I am trying to read the content of a meta tag of a secure web page. But finding it difficult as the properties are not the general one like name, author etc. If their is any way possible please tell.

Thanks in advance.


回答1:


did you gone through these post in php.net ?

<meta name="author" content="name">
<meta name="keywords" content="php documentation">
<meta name="DESCRIPTION" content="a php manual">
<meta name="geo.position" content="49.33;-86.59">
</head> <!-- parsing stops here -->

read these meta tags using php code writte below

<?php
// Assuming the above tags are at www.example.com
$tags = get_meta_tags('http://www.example.com/');

// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo $tags['author'];       // name
echo $tags['keywords'];     // php documentation
echo $tags['description'];  // a php manual
echo $tags['geo_position']; // 49.33;-86.59
?>

these codes taken from http://php.net/manual/en/function.get-meta-tags.php



来源:https://stackoverflow.com/questions/16426232/how-to-get-content-of-the-meta-tag-of-a-webpage

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!