Tools to Capture and Convert the Web

How do I change a filename of a screenshot with GrabzIt's API?

GrabzIt's API is very flexible and has multiple ways of interacting with your screenshots.

If you are using a server side API with a callback handler, you can change the handler file to specify the filename you want. So for PHP API you would change the line specified in the handler.php that saves your screenshot.

file_put_contents("results" . DIRECTORY_SEPARATOR . $filename, $result);

To include your custom filename, as shown below:

file_put_contents("results" . DIRECTORY_SEPARATOR . "my_screenshot.jpg", $result);

If you are using a server side API with the synchronous SaveTo method you can save the screenshot directly to a file with a name of your choice by doing something like the following.

$grabzIt->SaveTo("my_screenshot.jpg");

JavaScript works slightly differently, because with the JavaScript API you can only specify a filename if you are requesting that the screenshot be downloaded, as shown below.

GrabzIt("YOUR APPLICATION KEY").ConvertURL("http://www.spacex.com",
 {"download": 1,"filename":"my_screenshot.jpg"}).Create();