Website screenshots

前端 未结 26 3430
长发绾君心
长发绾君心 2020-11-21 06:07

Is there any way of taking a screenshot of a website in PHP, then saving it to a file?

26条回答
  •  隐瞒了意图╮
    2020-11-21 07:02

    I set up finally using microweber/screen as proposed by @boksiora.
    Initially when trying the mentioned link here what I got:

    Please download this script from here https://github.com/microweber/screen
    

    I'm on Linux. So if you want to run it, you may adjust my step follow to your environment.
    Here are the step I did on my shell on DOCUMENT_ROOT folder:

    $ sudo wget https://github.com/microweber/screen/archive/master.zip
    $ sudo unzip master.zip
    $ sudo mv screen-master screen
    $ sudo chmod +x screen/bin/phantomjs
    $ sudo yum install fontconfig
    $ sudo yum install freetype*
    $ cd screen
    $ sudo curl -sS https://getcomposer.org/installer | php
    $ sudo php composer.phar update
    $ cd ..
    $ sudo chown -R apache screen
    $ sudo chgrp -R www screen
    $ sudo service httpd restart
    

    Point your browser to screen/demo/shot.php?url=google.com. When you see the screenshot, you are done. Discussion for more advance setting is available here and here.

提交回复
热议问题