get meta description tag with xpath

后端 未结 5 1963
生来不讨喜
生来不讨喜 2021-02-07 06:39

I need the content the description and the keywords tag content. I have this code, but dont write anything. Idea?

$str = <<< EOD



        
5条回答
  •  不思量自难忘°
    2021-02-07 07:21

    Last but not least, and sorry for reviving this thread, the queries are case sensitive.

    In other words, if you look for meta name="description"... or "meta name="keywords", it will not find "meta name="Description"... or "meta name="Keywords"... respectively. So careful with that!

    And I can tell you, after working a while with xdom and metatags, eventually I believe that the best approach for that is to use this function: http://php.net/manual/es/function.get-meta-tags.php

提交回复
热议问题