In php, CutyCapt implements webpage screenshot saving code _ PHP Tutorial

Source: Internet
Author: User
In php, CutyCapt implements saving code on the webpage. QQ is the most commonly used Web page function, or asp.net is used. In fact, we can also directly use php for web pages, next I will introduce you to the web page function. QQ is the most commonly used function, or asp.net. In fact, we can also directly use php to access the web page, next I will introduce to you how php uses CutyCapt to implement web pages. if you need it, please refer to it.

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:

/*
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:
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:
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:

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:
/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:
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
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.