首页 > 开发 > Php > 正文

PHP获取网页截图

2020-09-12 14:39:47
字体:
来源:转载
供稿:网友

下载phantomjs.exe放到网站根目录 

下载地址: http://phantomjs.org/download.html

php开启exec,给予相应的权限 

代码如下:

<?php 

$filename=time(); 

$a=exec("phantomjs.exe rasterize.js http://www.cmsyuanma.com {$filename}.png",$out,$status); 

print_r($a); 

?> 

 

这里将会生成一个名为$filename的图片,图片内容就是 http://www.cmsyuanma.com  这个网页看到的内容。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表