从网址获取所有图片 [英] Fetching all the images from url

查看:62
本文介绍了从网址获取所有图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我正在测试一个网站.在那个网站上,我发现一些图像是按顺序排列的 例如

http://www.example.com/PHOTO/P323423.gif
http://www.example.com/PHOTO/P323424.gif
http://www.example.com/PHOTO/P323425.gif
http://www.example.com/PHOTO/P323426.gif

...

现在,我想获取/下载所有这些图像以供以后使用.

可以通过任何方式下载所有内容或在一页中查看.

我也尝试了此链接

http://www.example.com/PHOTO/

然后我得到一个错误- 您无权查看此页面.

请提出如何才能在一页中查看所有图像的信息. 用php编码的网站. 谢谢.

解决方案

您的源网址似乎遵循带编号的线性级数(例如-3423.gif至-3424.gif至-3425.gif).您是否考虑过使用php及其curl库?一个示例方法是:

1) Establish the bounds of your scrape (gif xxx - xyz)

2) Write a curl request loop that increments consistently in this range and gets the result

3) Refine the curl return and posit the info somewhere (local file i/o or database are two easy ways)

关于堆栈上一般卷曲的用法,这是一篇很棒的文章: PHP cURL GET请求和请求的正文

此外,尝试访问PHOTO的目录(或者可能是取决于应用程序的软件路线)可能会带来不同的权限,而不仅仅是尝试查看目录中的gif.这是您的网站吗?请注意,并非所有管理员都善意地进行网址抓取(您将采取的措施),最好是尝试与管理员联系以首先进行转储或清除,以抓取其服务器并阻止其流量. /p>

告诉我你的想法

干杯!

Today I am testing a site. in that site i found some images are in sequence for eg.

http://www.example.com/PHOTO/P323423.gif
http://www.example.com/PHOTO/P323424.gif
http://www.example.com/PHOTO/P323425.gif
http://www.example.com/PHOTO/P323426.gif

...

Now I want to fetch/download all these images for later use.

is there any way to download all these or see in one page.

I have tried this link also

http://www.example.com/PHOTO/

Then i got an error - You are not authorized to view this page.

Pls suggest how can i able to view all the images in one page. The site coded in php. Thanks.

解决方案

It looks as if your source urls follow a numbered, linear progression (e.g. -3423.gif to -3424.gif to -3425.gif). Have you thought about using php and its curl library? A sample approach would be:

1) Establish the bounds of your scrape (gif xxx - xyz)

2) Write a curl request loop that increments consistently in this range and gets the result

3) Refine the curl return and posit the info somewhere (local file i/o or database are two easy ways)

Here is a great post on general curl usage on stack: PHP cURL GET request and request's body

Furthermore, trying access the dir of PHOTO (or it may be a software route depending on the app) will probably entail different permissions rather than just trying to view a gif inside the dir. Is this your site? Be aware, not all admins take kindly to url scraping (what you would be doing) its best to try and get in contact with the admin for a dump or clearance in the first place to scrape their server and bog-down their traffic.

Tell me what you think

Cheers!

这篇关于从网址获取所有图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆