您能帮我找到一种使用 Goutte 从元描述、元关键字和机器人内容中获取内容的方法吗?另外,我该如何定位<link rel="stylesheet" href="">
and <script>
?
下面是我以前得到的PHP<title>
内容:
require_once 'goutte.phar';
use Goutte\Client;
$client = new Client();
$crawler = $client->request('GET', 'http://stackoverflow.com/');
$crawler->filter('title')->each(function ($node) {
$content .= "Title: ".$node->text()."";
echo $content;
});
这是 Goutte 的链接 -https://github.com/fabpot/goutte https://github.com/fabpot/goutte
您可以使用:
$crawler->filterXpath('//meta[@name="description"]')->attr('content');
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)