使用 PHP Simple HTML DOM Parse 但无法获取要显示的图像。
我不是编码员,我正在尝试从网站上提取文章和图像。文章很好,但图像不显示。而是显示部分路径,例如
> //ssl.gstatic.com/ui/v1/button/search-white.png
> //ssl.gstatic.com/ui/v1/button/search-white.png
> //ssl.gstatic.com/ui/v1/icons/common/settings.png
以谷歌为例,这是我正在使用的代码:
<?php
$html = file_get_html('https://news.google.com/nwshp?hl=en&tab=in');
foreach($html->find('h2') as $e)
echo $e->innertext . '<br><br>';
foreach($html->find('div.jsdisplay') as $e)
echo $e->innertext . '<br>';
foreach($html->find('img') as $element)
echo $element->src . '<br>';
?>
谢谢你的帮助