1

网站 html 是这样的,我想要使用 curl 的嵌入代码。

概念

<div id="postdiscriptiontext">
<p>
<embed src="http://videobb.com/e/swLN6oRlzFby" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="540" height="599"/>
</p>
</div>
I tried like this
 $html = str_get_html($links);
        echo $html->find('div.postdiscriptiontext p')->innertext . '<br>';

这是我收到的错误 通知:尝试在第 96 行的 C:\xampp\htdocs\anicravefinal\viewanimevideo.php 中获取非对象的属性

4

2 回答 2

2
$Content = '<div id="postdiscriptiontext">
<p>
<embed src="http://videobb.com/e/swLN6oRlzFby" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="540" height="599"/>
</p>
</div>';
preg_match_all('|<p>(.*?)</p>|',$Content,$Output);
print_r($Output);

如果你想用这个你可以试试

$Content = file_get_contents('URL OF PAGE THAT YOU WANT TO GRAB');
于 2012-09-26T13:38:02.077 回答
0

像这样试试

    <?php
    $html = '<div id = "postdiscriptiontext">
                <p>
                    <embed src = "http://videobb.com/e/swLN6oRlzFby" type = "application/x-shockwave-flash" allowscriptaccess = "always" allowfullscreen = "true" width = "540" height = "599"/>
                </p>
            </div>';

    $doc = new DOMDocument();
    $doc->loadXML($html);
    $myHtml = $doc->getElementsByTagName("p");
    $myHtml = $myHtml->item(0)->nodeValue;
    ?>
于 2012-09-26T14:08:43.987 回答