PHP中的单页Web爬网

| 我是PHP新手。有人可以帮我弄清楚如何抓取单个html页面并在该页面的源代码中打印所有单词吗?     
已邀请:
        
$words = explode(\" \", strip_tags(file_get_contents(\"www.example.com\"));
function trim_and_print(&$value) 
{ 
    trim($value);
    if(strlen($value > 3) 
        echo $value;
}

array_walk($words, \'trim_and_print\');
这应该打印长度> 3的单词。感谢moteutsch提供的file_get_contents     
        您的问题不是很清楚,但是您需要下载页面(使用cURL或PHP \的文件功能)并以某种方式处理文件。这是一个基本的解决方案:
echo strip_tags(file_get_contents(\'http://www.google.com\'));
    

要回复问题请先登录注册