PHP Classes

Webshots: Get a screenshot of a page using the plsein API

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 1,493 All time: 2,626 This week: 54Up
Version License PHP version Categories
webshots 1.0.5Free To Use But R...5PHP 5, Graphics, Web services
Description 

Author

This class can Get a screenshot of a page using the plsein API.

It can send a HTTP request to the plsein.in API Web server to get a screenshot of a Web page given its URL.

The API returns the URL for the screenshot image. The class retrieves and copies the screenshot image file to a given local file.

Picture of PLSCIS PLP
Name: PLSCIS PLP <contact>
Classes: 3 packages by
Country: India India
Innovation award
Innovation award
Nominee: 1x

Example

<?php

$url
= "http://www.yahoo.com/";
$img = "/var/www/images/img.png";

include_once(
'webshots.php');
$wobj = new webshots();

if(
$wobj->url_to_image($url, $img)) {
    echo
"image created";
} else {
    echo
"some error occured please check response from api";
}
exit;
?>


Details

Api parameters:- 1) api url: http://pls-e.in/api/webshots 2) post parameters: > params: array containing req. info about class file to be generated > url: url of webpage (e.g.: http://www.example.com) > height: optional height of image (only positive integer) > width: optional width of image (only positive integer) > fullpage: y means image will be of whole page and n means not > trim: y means it will try to remove extra white space surrounding the image > webshot: optional parameter to create webshot instead of guaranteed fullpage image > cropTop: optional parameter to crop image from top instead of center > ui: array containing user identification parameters > sec_code: value of secret code (will be available from profile page) > key: value of secret key (will be available from profile page) 3) response: > date: image content if image is generated > er: error information if any error occured during image creation > Below example is just a demo for how to call api and use its out-put and you can even use its out-put in different way > but we will recommend to call it from ajax, store image at their end once obtained from this api and use that image for multiple loading as direct loading will take much more time for the page to load. > also almost every time image will be png but if you face problem where it gives jpeg image then please check image's mime type beforing storing / creating image st your end. > due to caching some time, image same as that of previous call might be send on subsequent calls even if urls of webpage for which image is req. are different; to prevent this append random unique time based parameter to end of api url (as done in below example) > In-case of any doubt, please feel free to contact us through contact page on our website http://pls-e.in/site/contact

  Files folder image Files (3)  
File Role Description
Plain text file readme.txt Doc. documentation file
Plain text file webshots.php Class url to image
Plain text file webshots_test.php Example demo script to use webshots class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,493
This week:0
All time:2,626
This week:54Up
User Ratings User Comments (3)
 All time
Utility:90%StarStarStarStarStar
Consistency:84%StarStarStarStarStar
Documentation:78%StarStarStarStar
Examples:84%StarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:273
 
Excellent work to generate image view of a website
6 years ago (javaria razzaq)
80%StarStarStarStarStar
good job :)
11 years ago (tomtheman)
77%StarStarStarStar
This is a good and useful class :-)
11 years ago (José Filipe Lopes Santos)
80%StarStarStarStarStar