1
Im bekommen mit Goutte\Client
in Laravel 5.2 und es scheint, dass es nicht den Meta-Tags Inhalt bekommen kann, aber den Titel bekommen, Links, etc.Laravel Goutte nicht Meta-Tags
Das gibt leere Zeichenfolge zurück.
$parse = $htmlParser->request('GET', 'http://www.sample.com');
$parse->filter('meta');
Ausgang:
private 'nodes' =>
array (size=20)
0 =>
object(DOMElement)[289]
public 'tagName' => string 'meta' (length=4)
public 'schemaTypeInfo' => null
public 'nodeName' => string 'meta' (length=4)
public 'nodeValue' => string '' (length=0)
public 'nodeType' => int 1
public 'parentNode' => string '(object value omitted)' (length=22)
public 'childNodes' => string '(object value omitted)' (length=22)
public 'firstChild' => null
public 'lastChild' => null
public 'previousSibling' => null
public 'nextSibling' => string '(object value omitted)' (length=22)
public 'attributes' => string '(object value omitted)' (length=22)
public 'ownerDocument' => string '(object value omitted)' (length=22)
public 'namespaceURI' => null
public 'prefix' => string '' (length=0)
public 'localName' => string 'meta' (length=4)
public 'baseURI' => null
public 'textContent' => string '' (length=0)
Diese den Titel zurückgibt.
$parse = $htmlParser->request('GET', 'http://www.sample.com');
$parse->filter('title');
Ausgang:
private 'nodes' =>
array (size=1)
0 =>
object(DOMElement)[289]
public 'tagName' => string 'title' (length=5)
public 'schemaTypeInfo' => null
public 'nodeName' => string 'title' (length=5)
public 'nodeValue' => string 'Test title' (length=36)
public 'nodeType' => int 1
public 'parentNode' => string '(object value omitted)' (length=22)
public 'childNodes' => string '(object value omitted)' (length=22)
public 'firstChild' => string '(object value omitted)' (length=22)
public 'lastChild' => string '(object value omitted)' (length=22)
public 'previousSibling' => string '(object value omitted)' (length=22)
public 'nextSibling' => string '(object value omitted)' (length=22)
public 'attributes' => string '(object value omitted)' (length=22)
public 'ownerDocument' => string '(object value omitted)' (length=22)
public 'namespaceURI' => null
public 'prefix' => string '' (length=0)
public 'localName' => string 'title' (length=5)
public 'baseURI' => null
public 'textContent' => string 'Test title' (length=36)
Haben Sie das versucht? http://stackoverflow.com/questions/22674916/how-to-get-meta-description-content-using-goutte –