你能帮我找到一种方法来获得一个内容从元描述,元关键字和机器人内容使用Goutte。另外,如何定位<link rel="stylesheet" href="">和<script>
下面是我用来获取<title>内容的PHP:
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的链接
发布于 2014-09-11 16:27:22
您可以使用:
$crawler->filterXpath('//meta[@name="description"]')->attr('content');https://stackoverflow.com/questions/22674916
复制相似问题