PHP如何抓取网站或者某个网页的快照图片
1、//设置运行不超时;
header("Content-Type:text/html; charset=utf-8");
set_time_limit(0);
2、//设置抓取网址
$url="http://www.chinawinxp.com";
3、 //设置图片名称(以当前时间戳命名)
$time=time();
4、 //设置图片输出地址
$outdir = 'E:/BaseServer/htdocs/curlImg/'.$time.".png";
5、 //CutyCapt绝对路径
$path = 'E:/BaseServer/htdocs/CutyCapt.exe';
6、//命令
$cmd = "$path --url=$url --out=$outdir";
7、 //执行命令
exec($cmd);
8、代码视图:

9、运行结果。

10、完整代码:
<?php
header("Content-Type:text/html; charset=utf-8");
set_time_limit(0);
//抓取网址
$url="http://www.chinawinxp.com/static/php/2014/1222/75.html";
//设置图片名称
$time=time();
//设置图片输出地址
$outdir = 'E:/BaseServer2/htdocs/curlImg/'.$time.".png";
//CutyCapt绝对路径
$path = 'E:/BaseServer2/htdocs/CutyCapt.exe';
//命令
$cmd = "$path --url=$url --out=$outdir";
//执行命令
exec($cmd);
echo "图片抓取成功!";
11、CutyCapt.exe百度网盘下载地址:
http://pan.baidu.com/s/1i3DuKct