Using CutyCapt in php to save webpage screenshots

Source: Internet
Author: User

You may use QQ or asp.net to implement the web page function most. In fact, we can also directly use php for Web pages. Next I will introduce php to use CutyCapt to implement web pages, for more information, see.

CutyCapt: http://sourceforge.net/projects/cutycapt/files/cutycapt/

Windows CutyCapt does not need to be installed. simply save it to your computer.

Then write the following php code:

The Code is as follows: Copy code

<? Php
/*
Web page function, IE + CutyCapt must be installed
Url: the desired webpage
Out: Image Storage path
Path: CutyCapt path
Cmd: CutyCapt
For example, http: // your php path. php? Url = http://www.bkjia.com
*/
$ Url = $ _ GET ["url"];
$ Imgname = str_replace ('HTTP: // ', '', $ url );
$ Imgname = str_replace ('https: // ', '', $ imgname );
$ Imgname = str_replace ('.', '-', $ imgname );
$ Out = 'd:/webroot/test/'.w.imgname.'.png ';
$ Path = 'd:/webserver/CutyCapt.exe ';
$ Cmd = "$ path -- url = $ url -- out = $ out ";
Echo $ cmd;
System ($ cmd );
?>

If you are a linux system, you need to simply configure CutyCapt.


Install website software CutyCapt
 

1. Install Qt47 first
Added download source for qt47

The Code is as follows: Copy code
Vi/etc/yum. repos. d/atrpms. repo
[Atrpms]
Name = CentOS $ releasever-$ basearch-ATrpms
Baseurl = http://dl.atrpms.net/el?releasever-#basearch/atrpms/stable
Gpgkey = http://ATrpms.net/RPM-GPG-KEY.atrpms
Gpgcheck = 1
Enabled = 1

[Atrpms-testing]
Name = CentOS $ releasever-$ basearch-ATrpms testing
Baseurl = http://dl.atrpms.net/el?releasever-#basearch/atrpms/testing
Gpgkey = http://ATrpms.net/RPM-GPG-KEY.atrpms
Gpgcheck = 1
Enabled = 1

Yum update
Yum installqt47
Yum installqt47-devel
Yum installqt47-webkit
Yum installqt47-webkit-devel

There may be an error message
Warning: qt44-x11-4.4.3-10_4.el5.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 66534c2b
Error: Failed dependencies:
LibGLU. so.1 () (64bit) is needed by qt44-x11-4.4.3-10_4.el5.x86_64
Libmng. so.1 () (64bit) is needed by qt44-x11-4.4.3-10_4.el5.x86_64
Solution:
Yum-y installqt-devel *
 
Ii. Install CutyCapt

The Code is as follows: Copy code
Cd/data0/software
Svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
Mv cutycapt/CutyCapt/usr/local/cutycapt
Cd/usr/local/cutycapt
Qmake
Make

An error may be reported here.
Make: *** [CutyCapt] Error 1
Solution:
Yum update sqlite
Execute make again
 
If the qmake-qt47 is not successful, execute make again
 
3. Download x-server

The Code is as follows: Copy code
 
Wget http://www.flexthinker.com/wp-content/uploads/2009/11/xvfb-run.sh.txt
Mv./xvfb-run.sh.txt/usr/local/cutycapt/xvfb-run.sh
Chmodu + x/usr/local/CutyCapt/xvfb-run.sh

 
 
4. Install the Chinese package
Yum installfonts-chinese
 
 
5. Install ImageMagick
Yum installImageMagick
 
Vi. test:
 

The Code is as follows: Copy code
/Usr/local/cutycapt/xvfb-run.sh -- server-args = "-screen 0, 1024x768x24 "/usr/local/cutycapt/CutyCapt -- url = http://www.bkjia.com -- out =/tmp/163.jpg

 
163.jpg is not loaded with flash
 
7. Download the 64-bit flash plug-in:

The Code is as follows: Copy code
Cd/data0/software
# Wget http: // 119.188.72.26/1/ishare.down.sina.com.cn/14036482.so? Ssig = YB70Xk7Ph9 & Expires = 1340899200 & KID = sina, ishare & ip = 1340777795,114.255 .44. & fn = libflashplayer. so
<A href = "http://ishare.iask.sina.com.cn/f/13659493.html" target = "_ blank"> http://ishare.iask.sina.com.cn/f/13659493.html </a>
Ll/usr/lib64/mozilla/plugins/
Lrwxrwxrwx 1 root 41 06-27 libflashplayer. so->/usr/lib64/flash-plugin/libflashplayer. so
Cp/data0/software/libflashplayer. so/usr/lib64/flash-plugin/

 
Test loaded successfully


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.