1
搜索谷歌,PHP文檔和ofc堆棧溢出,找不到合適的東西,我需要一些代碼的幫助,我需要爲我的函數file_get_html
寫一個if
聲明,使用Simple HTML DOM Parser
如果聲明file_get_html簡單的HTML Dom解析器
我需要用一個簡單的回聲返回喜歡Hello World
,如果它只是顯示爲http://sweetvideos.net
卻會輸出$element->content
因爲我目前的劇本確實爲og:image
我給它一些嘗試自己幾個小時,並保持與該返回..
file_get_contents(http://sweetvideos.net): failed to open stream: HTTP request failed! HTTP/1.1 404 NOT FOUND
任何人都可以幫我嗎?
我的代碼:
include('include/simple_html_dom.php');
$url = "?video=12c11210";
$html = file_get_html('http://sweetvideos.net' . $url);
if ($html->find('meta[property=og:image]')) {
foreach ($html->find('meta[property=og:image]') as $element) {
$img[] = $element->attr['content'];
}
}
我不熟悉捲曲,但自從我目前的代碼工作,我只需要幫助擴展。 –
可以請你分享一下simple_html_dom.php嗎? –
http://simplehtmldom.sourceforge.net/ –