Most screenshot services do not support taking screenshots behind a login, however to enable this we have opened up the ability to set cookies in GrabzIt. As websites often use cookies to identify a user, if you assign the users session cookie to GrabzIt all the users session data will be available when any screenshots are taken.
GrabzIt provides two main ways of specifying your own session cookie either via the API or on setting the cookies in your account.
If you specify all of the user's session cookies then when you create a capture of a secure web page GrabzIt will create a capture as the user would see it, this is very useful if you want to do things like capture a report in a user's dashboard etc.
In this example we are assuming there is only one cookie involved in the user's session called PHPSESSID, however there could be more than one and could be named differently. It all depends on how you have created your website. One way to debug any cookie issues, is by signing into the target website and use the browsers built in developer tools, to do this in the Chrome browser just press F12.
Then identify the websites session cookie and add name, domain and value etc of this cookie to GrabzIt by using the custom cookies page, it is a good idea to use a expiration date a long time in the future to ensure the session cookie is not deleted.
To do this programmatically, you need to use a server-side language as JavaScript won’t have access to the HTTP only cookies often associated with a user's session cookies. Then pass the all of the cookies involved in a user’s session using the SetCookie
method and GrabzIt will automatically be able to user the users session.
$sessionValue = $_COOKIE['PHPSESSID']; $grabzIt->SetCookie('PHPSESSID', 'example.com', $sessionValue); $grabzIt->URLToImage('http://example.com/dashboard.php'); $grabzIt->Save('http://example.com/handler.php');
Use our JavaScript API to send us the HTML of the web page that is behind the login. As long as none of the web page resources, such as CSS, JavaScript and images, are not restricted by website security it should capture the users web page correctly as shown in this example.
This login method will only work if the web page you want to capture is the web page directly after the login screen or if the website provides a redirect URL that the browser will follow after login is complete.
Some web pages use basic authentication were the browser asks the user to authenticate themselves before displaying the page. GrabzIt enables you to screenshot these web pages by specifying your basic authentication credentials.