In any language. Can I capture a web page and save its image file? (no installation, no activeX)

I heard that it is possible to capture web pages using PHP (possibly above 6.0) on a Windows server.

I got a sample code and tested it. but there is no code to work properly.

If you know the right ways to capture a web page, save the image file in web applications?

Please teach me.

-one
php screen-capture
Jul 03 '09 at 6:19 06:19
source share
3 answers

you can use api browsers http://browsershots.org/

with the xml-rpc interface, you can really use almost any language to access it.

http://api.browsershots.org/xmlrpc/

+5
Jul 03 '09 at 6:54
source share

Although you asked for a PHP solution, I would like to share another solution with Perl. WWW :: Mechanize, along with LWP :: UserAgent and HTML :: Parser, can help clear the screen.

Some documents for reference:

+1
Jul 03 '09 at 6:35
source share

Downloading the html of a web page is commonly called screen cleaning. This can be useful if you want the program to retrieve data from this page. The easiest way to request HTTP resources is to use the cURL tool call. cURL comes as a standalone unix tool, but there are libraries that can be used in every programming language. To capture this page from a Unix command prompt:

curl http://stackoverflow.com/questions/1077970/in-any-languages-can-i-capture-a-webpageno-install-no-activex-if-i-can-plz 

In PHP you can do the same:

 <?php $ch = curl_init() or die(curl_error()); curl_setopt($ch, CURLOPT_URL,"http://stackoverflow.com/questions/1077970/in-any-languages-can-i-capture-a-webpageno-install-no-activex-if-i-can-plz"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data1=curl_exec($ch) or die(curl_error()); echo "<font color=black face=verdana size=3>".$data1."</font>"; echo curl_error($ch); curl_close($ch); ?> 

Now, before copying the entire website, you should check the robots.txt file to make sure robots are allowed to host your site, and you can check if there is an API available that allows you to retrieve data without HTML.

-2
Jul 03 '09 at 6:34
source share



All Articles