如何从视图源中提取 a 的“内容”值
我使用 CURL 来获取页面的来源,但之后我无法识别以下内容:
<meta property="og:title" content="Zoe's big surprise">
<meta property="og:description" content=" ">
<meta property="og:type" content="video">
<meta property="og:image" content="http://i1.ytimg.com/vi/PNyMlswZb-I/hqdefault.jpg">
基本上我需要在一个数组中捕获所有上述参数并使用它们。我在 curl 之后尝试了以下操作
//parsing begins here:
$doc = new DOMDocument();
@$doc->loadHTML($data);
$nodes = $doc->getElementsByTagName('title');
//get and display what you need:
$title = $nodes->item(0)->nodeValue;
$metas = $doc->getElementsByTagName('meta'); --This line is not able to fetch any <meta> content>
谢谢