我正在尝试读取一个安全网页的元标签的内容。但是发现它很难,因为属性不是一般的,如姓名,作者等。如果他们是任何可能的方式,请告诉。
提前谢谢。
发布于 2013-05-08 03:09:42
你在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 -->使用下面编写的php代码读取这些meta标签
<?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
?>这些代码取自http://php.net/manual/en/function.get-meta-tags.php
https://stackoverflow.com/questions/16426232
复制相似问题