PHP screen capture

Source: Internet
Author: User
How does PHP capture screens? In Windows, use PHP for web pages. in Apache service properties, select "allow service and desktop switch" on the "login" tab !? & Lt ;? Php $ browser = newCOM ("InternetExplorer. Application"); $ handle = $ browser-& gt how does PHP capture screens?
Using PHP for web pages in Windows

In Apache service properties, select "allow service and desktop switch" on the "login" tab!

?

 HWND;$browser->Visible = true;$browser->Width = 500;$browser->Height = 500;$browser->Navigate("http://www.un.org");/* Still working? */while ($browser->Busy) {    com_message_pump(4000);}$im = imagegrabwindow($handle, 0);$browser->Quit();imagepng($im, "iesnap.png");?> 

? When this code is run, an IE window will pop up on the server and the specified website will be automatically opened. the screen capture window will be closed automatically, which is quite a fool!

?

?

?

?

?

Using PHP for web pages in Linux

When alexa is on, you can always see alexa display of the homepage of the queried website. how can this be achieved.
By looking at the page content, we found that it was originally obtained by calling amazon's service programs.
Http://ast.amazonaws.com/Xino? Action = Redirect & Service = AlexaSiteThumbnail & Url = baidu.com &
AWSAccessKeyId = 1FVZ0JNEJDA5TK457CR2 & Signature = tz4xyqDNcSf8A1v % 2BpDo4todvM9c % 3D &
Size = Small & Timestamp = 2008-03-04T06% 3A04% 3A47. 422Z &
Bytes
If you want to make this effect on your website, you can obtain this calling interface by applying for an ID on amazon.
But how can this be in line with the spirit of inquiry? Therefore, after some rummaging, find the following method to implement the homepage of the website.

Create a thumbnail of the home page.
Steps:
1. start a page capture tool to capture the homepage of the selected website;
2. store captured pages to the server;
3. process the captured page as needed;
4. display the result to the user.
To sum up, the key is to have a stable crawling tool. after searching online, find the following tools.

In windows, you can consider this tool to capture the page:
IECapt.exe
In linux, you can consider this tool to capture the page:
HTML2Image
After obtaining the capture tool, you can write programs in any server language, call the capture tool, and return the results to the user.
The following uses iecapt.exe and uses PHP to capture websites.
Run in Windows/Apache2.2/Php5.2.5.

References:
1. http://www.zubrag.com/scripts/website-thumbnail-generator.php
2. http://www.guangmingsoft.net/htmlsnapshot/html2image.htm

Official url: http://www.guangmingsoft.net/htmlsnapshot/html2image.htm
Linux kernel-2.2.14 and above: install required lib and related software
Yum install-y glibc gtk + fontconfig ?? Cairo libpixman pango-devel
Download html2image
Wget http://www.guangmingsoft.net/htmlsnapshot/html2image.i386.tar.gz
Tar xvzf html2image.i386.tar.gz
CD html2image
Set the LD_LIBRARY_PATH path
Export LD_LIBRARY_PATH = ./
Mkdir/usr/X11R6/lib
Ln-s/usr/share/X11/usr/X11R6/lib/X11
Run Xvfb
./Xvfb: 1-screen 0 640x480x24-nolisten tcp-audit 4-auth X1.cfg & export DISPLAY =: 1
Generating images
./Html2image www.google.com a.jpg
Negligible errors:
Error opening security policy file/usr/X11R6/lib/X11/xserver/SecurityPolicy
Cocould not init font path element/usr/X11R6/lib/X11/fonts/TTF/, removing from list!
Cocould not init font path element/usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Cocould not init font path element/usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Cocould not init font path element/usr/X11R6/lib/X11/fonts/CID/, removing from list!
Generate capacity in 1024x768 format
Jpg 871 K
Gif 4.12 M
. Png 1.13 M

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.