GrabzIt provides two main ways of doing this via a login web service or by specifying your own session cookie.
Automatically create a login cookie
- Warning this feature is currently in beta and may not provide consistent results.
The login web service requires the form URL to submit too, along with any required form parameters, and your application key. After the web service executes any cookies are automatically saved to your account. Now when you take a screenshot of a webpage on the same domain these cookies will be used. An example of a login form to submit to is shown below.
<form action="login.php" method="post">
<input type="text" name="username" value="">
<input type="password" name="password" value="">
<input type="submit" class="submit" value="Login">
Remember to URL encode every parameter value!
The login web service has the following format. You must specify the URL the form is being submitted to, your application key and all of the form parameters you want to submit.
Note that we do not store any of the login details you pass to us for your security.
https://api.grabz.it/services/login.ashx?key=Sign in to view your Application Key&formurl=[URL of the form]&
[form parameter one]=[form value one]&[form parameter two]=[form value two]&[form parameter ...]=[form value ...]
Below is an example of how to submit to the above login form.
https://api.grabz.it/services/login.ashx?key=Sign in to view your Application Key&formurl=http://www.example.com/login.php&username=joebloggs&password=12345
This call will return XML detailing all of the cookies that where saved to your account by this action. For the login to be successful the target websites session cookie must be listed, if it is you can now create captures of the web pages that require a logged in user.
Specifying your own login cookie
Alternatively to specify your own login cookie you can use the
SetCookie method to define your own user session cookies. An example of this using PHP is shown below.
$sessionValue = $_COOKIE['PHPSESSID'];
$grabzIt->SetCookie('PHPSESSID', 'example.com', $sessionValue);
This example assumes that the PHP session cookie is named PHPSESSID. Of course this is a complicated subject and so might be difficult to implement. Therefore you could attempt to debug any cookie issues, 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 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.
Post to a login form
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.
Specify Basic Authentication Credentials
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.