search
Homephp教程php手册PHP100精华:PHP生成网页快照

PHP100精华:PHP生成网页快照

Jun 13, 2016 am 10:33 AM
echophpsnapurlSnapshotcrawlgenerateBaiduEssenceWeb page

$url = www.baidu.com; //抓取百度
echo snapshot($url);  //输出结果为图片地址
echo snapshot($url, ./baidu.png); //将图片保存至本地baidu.png, 输出内容图片大小

/**
 * 生成网页快照
 * Fr bkJia.com 论坛 xiaokai
 * @param   string  $site   目标地址
 * @param   string  $path   保存地址, 为空则不保存
 * @param   integer $dealy  延迟
 * @return  mixed   根据参数返回
 */
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(无效网址);
    }


    $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;
}
 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool