2017 © Pedro Peláez
 

application webshot

PHP application for generate screenshots Web pages

image

lciolecki/webshot

PHP application for generate screenshots Web pages

  • Saturday, March 22, 2014
  • by lciolecki
  • Repository
  • 0 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Webshot screen server

Webshot Screen Server it's an web application for generate website screenshots. System is based on CutyCapt application (http://cutycapt.sourceforge.net). It's allows you to take screenshots of any web pages and save them as images in png formats. Application was created in PHP technology and uses Zend Framework whith Doctrine 2., (*1)

Required: xvfb-run and cutycapt applications., (*2)

Avaiable options: url,min-width,min-height,max-wait,delay,user-style-path,user-style-string,header,method,body-string,body-base64,app-name,app-version,user-agent,app,javascript,java,plugins,private-browsing,auto-load-images,js-can-open-windows,js-can-access-clipboard,print-backgrounds,zoom-factor,zoom-text-only,http-proxy., (*3)

Installation using Composer

{
    "minimum-stability": "dev",
    "require": {
        "lciolecki/webshot": "dev-master"
    }
}

Important: For property install, please use: composer install -o, (*4)

Sample use in Zend Framework

public function webshotAction()
{
        $params = array(
          'url' => 'http://google.pl',
          'hash' => '2131sada', //unique identifcator of service
          'sign' => 'adad13123' //sign key for http://google.pl + 2131sada
        );

        $url = 'yourdomain/api/create';            
        $client = new Zend_Http_Client($url);
        $client->setMethod(Zend_Http_Client::POST)
               ->setHeaders('X-Requested-With', 'XMLHttpRequest') 
               ->setParameterPost($params)
               ->setConfig(array('timeout' => 180));

        $response = $client->request();

        $return = Zend_Json::decode($response->getBody());
        $code = isset($return['code']) ? $return['code'] : 200;

      if ($code === 200) {
          $this->_helper->viewRenderer->setNoRender(true);
          $this->_helper->layout->disableLayout();

          $content = file_get_contents($return['image']);
          $this->getResponse()->setHeader('Content-type', 'image/png');
          $this->getResponse()->setBody($content);
          $this->getResponse()->sendResponse();  
        } else {
          throw new Exception('An error on generate screenshot');
        }
    }

The Versions

22/03 2014

dev-master

9999999-dev http://webshot.ciolecki.pl

PHP application for generate screenshots Web pages

  Sources   Download

BSD-3-Clause

The Requires

 

php server screenshots screen webshot