Home >php教程 >php手册 >PHP实现即时网站截图[转]

PHP实现即时网站截图[转]

WBOY
WBOYOriginal
2016-06-07 11:44:041106browse

转一个通过PHP实现即时网站截图功能
通过一个表单来提交请求<form> <br> 网站地址 (不带 http://):<input><br><br> 大小: <br> <input>px<br><br> <input>px<br><br> 图片格式:<br> <select><br> <option>PNG</option> <br> <option>JPEG</option> <br> </select> <br> <br> <input> </form>处理页面..<?php <br /> $x = $_REQUEST['x'];<br> $y = $_REQUEST['y'];<br> $format = $_REQUEST['format'];<br> $site = $_REQUEST['site'];<br> $surl = 'http://0907.org/screenshot/screenshot_it.php?site='.$site.'&x='.$x.'&y='.$y.'&format='.$format;<br> if($_REQUEST['format'] == 'PNG') {<br> $ifm = 'png';<br> } else {<br> $ifm = 'jpg';<br> }<br> $imt = 'image/'.$ifm;<br> $ifn = 'screenshot.'.$ifm;<br> if(isset($_REQUEST['preview'])) {<br> $iurl = 'http://域名/子目录/screenshot_it.php?site='.$site.'&x='.$x.'&y='.$y.'&format='.$format; <br> $gwptitle = $_REQUEST['site'].' blog.0907.org';<br> include_once("../css.php");   <br> //这里可以删除呦!因为是CSS<br>  <br> echo '<div>';<br> echo '» <b>点击图片下载截图!</b> </div> <br><a><img alt="PHP实现即时网站截图[转]" ></a><br>';<br> } else {<br> header("Content-type: $imt");<br> header("Content-Disposition: attachment; filename= $ifn");<br> readfile($surl);<br> }<br> ?>

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn