我想要
- 使用从我的网站获取所有图像PHP 简单 HTML DOM 解析器 http://simplehtmldom.sourceforge.net/
- 并将它们全部导出到我的桌面
ALL
立刻。 (Not
右键单击保存或屏幕截图)
OPTIONAL- 保存所有hyperlinks
到一个漂亮的文本文件中。
这是我尝试过的,
<?php include_once('/php/simple_html_dom.php'); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML DOM Parser</title>
</head>
<body>
<?php $html = file_get_html('http://my-website.com'); ?>
<div class="row">
@foreach($html->find('img') as $img)
<div id="pic" class="col-sm-1">
{{$img}}
</div>
@endforeach
</div>
</div>
</body>
</html>
我可以加载图像,但我不知道如何将它们保存到我的计算机中。
我不确定是否可能。
有没有 php 函数或 JS 函数可以做到这一点?
要将 URL 保存到文件中,请执行以下操作:
@foreach($html->find('img') as $img)
file_put_contents('file.txt', $img."\r\n", FILE_APPEND); # this line saves URL to file
<div id="pic" class="col-sm-1">
{{$img}}
</div>
@endforeach
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)