<? Php
$ Url = www.baidu.com; // capture Baidu
Echo snapshot ($ url); // The output result is the image address.
Echo snapshot ($ url,./baidu.png); // Save the image to baibaidu.png, and the size of the output image
/**
* Generate a web Snapshot
* Fr bkjia.com Forum xiaokai
* @ Param string $ site Destination Address
* @ Param string $ path: Save address. If it is null, It is not saved.
* @ Param integer $ dealy latency
* @ Return mixed return parameters
*/
Function snapshot ($ site, $ path =, $ dealy = 0)
{
$ Url = http://ppt.cc/yo2/catch.php;
$ Query = url =. $ site. & delay =. $ dealy. & rnd =. mt_rand (1, 9 );
$ Ch = curl_init ($ url );
Curl_setopt ($ ch, CURLOPT_POST, true );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ query );
Curl_setopt ($ ch, CURLOPT_USERAGENT, $ _ SERVER [HTTP_USER_AGENT]);
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Data = curl_exec ($ ch );
Curl_close ($ ch );
If (strlen ($ data )! = 32 ){
Exit (Invalid URL );
}
$ File = $ data {0}./. $ data {1}./. $ data {2 }./;
$ File = http://cache.ppt.cc/. $ file. src _. $ data.. png;
If (! Empty ($ path )){
$ Data = file_get_contents ($ file );
Return file_put_contents ($ path, $ data );
}
Return $ file;
}