1
如何使用preg匹配获取此字符串的链接?使用preg匹配获取标签的内容全部
<h3 class='post-title entry-title'>
<a href='http://domain.blogspot.com/2011/03/blog-post_111.html'>Test Post</a>
</h3>
这是我做的,到目前为止
<?php
$string = file_get_contents('http://www.domain.com');
$regex_pattern = "/<h3 class=\'post-title entry-title\'>([^`]*?)<\/h3>/";
unset($matches);
preg_match_all($regex_pattern, $string, $matches);
foreach ($matches[0] as $paragraph) {
echo $paragraph;
echo "<br>";
}
?>
谢谢!
您好CanSpice和感谢信息。请你能给我一个关于如何转换我的代码的例子吗?我用它更新了我的帖子。 – EnexoOnoma 2011-03-24 20:29:23