Description
This class handles all communication with the GrabzIt screenshot web services.
Public Methods
- get_result(id)
- url_to_animation(url, options)
- url_to_image(url, options)
- html_to_image(html, options)
- file_to_image(path, options)
- url_to_pdf(url, options)
- html_to_pdf(html, options)
- file_to_pdf(path, options)
- url_to_docx(url, options)
- html_to_docx(html, options)
- file_to_docx(path, options)
- url_to_table(url, options)
- html_to_table(html, options)
- file_to_table(path, options)
- url_to_rendered_html(url, options)
- html_to_rendered_html(html, options)
- file_to_rendered_html(path, options)
- url_to_video(url, options)
- html_to_video(html, options)
- file_to_video(path, options)
- save(callBackUrl, oncomplete)
- save_to(saveToFile, oncomplete)
- get_status(id, oncomplete)
- get_cookies(domain, oncomplete)
- set_cookie(name, domain, options, oncomplete)
- delete_cookie(name, domain, oncomplete)
- get_watermarks(oncomplete)
- get_watermark(identifier, oncomplete)
- add_watermark(identifier, path, xpos, ypos, oncomplete)
- delete_watermark(identifier, oncomplete)
- set_local_proxy(value)
- use_ssl(value)
- create_encryption_key()
- decrypt(data, key)
- decrypt_file(path, key, oncomplete)
get_result(id)
This method returns the screenshot itself. If nothing is returned then something has gone wrong or the screenshot is not ready yet.
Parameters
-
id - the unique identifier of the screenshot
url_to_animation(url, options)
Specifiy the URL of the online video that should be converted into a animated GIF.
Parameters
-
url - the URL of the online video to convert into an animated GIF
- Required
-
Accepts Vimeo and YouTube video URL's
- Warning animating Vimeo and YouTube videos depends on a third party and so may not provide consistent results.
- options - a JSON object that defines any special options to use when creating the animated GIF.
Return Value
void
Animation Options
All of the options available when creating an animated GIF.
-
customId - custom identifier that you can pass through to the animated GIF web service. This will be returned with the callback URL you have specified.
-
width - the width of the resulting animated GIF in pixels.
- Default: 180px
- Maximum: Maximum width for package
- Auto-size: -1 (passing -1 means that the width of the animated GIF is scaled in relation to its height, if the width is being auto-sized the height cannot)
-
height - the height of the resulting animated GIF in pixels.
- Default: 120px
- Maximum: Maximum height for package
- Auto-size: -1 (passing -1 means that the height of the animated GIF is scaled in relation to its width, if the height is being auto-sized the width cannot)
-
start - the starting position of the video that should be converted into a animated GIF.
-
duration - the length in seconds of the video that should be converted into a animated GIF.
- Default: maximum length for package
-
speed - the speed of the animated GIF.
- Default: 1
- Minimum: 0.2
- Maximum: 10
-
framesPerSecond - the number of frames per second that should be captured from the video.
- Default: 10
- Minimum: 0.2
- Maximum: 60
-
repeat - number of times to loop the animated GIF.
- Default: 0
- Loop Continuously: 0
- Never Loop: -1
-
reverse - if true the frames of the animated GIF are reversed
-
customWaterMarkId - add a custom watermark or special watermark to the animated GIF
-
quality - the quality of the returned image, which has a default compression of 85%.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
country - the country the animated GIF should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
Options Example
{
'width':250,
'height':250,
'speed':2
}
url_to_image(url, options)
Specifies the URL that should be converted into a image screenshot.
Parameters
-
url - the URL that the screenshot should be made of
- options - a JSON object that defines any special options to use when creating the screenshot.
Return Value
void
html_to_image(html, options)
Specifies the HTML that should be converted into a image.
Parameters
Return Value
void
file_to_image(path, options)
Specifies a HTML file that should be converted into a image.
Parameters
-
path - the file path of a HTML file to convert into a image
- options - a JSON object that defines any special options to use when creating an image.
Return Value
void
Image Options
All of the options available when creating image captures.
-
customId - custom identifier that you can pass through to the screenshot webservice. This will be returned with the callback URL you have specified.
-
browserWidth - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
-
browserHeight - the height of the browser in pixels
- Default: 1170
- Maximum: 10000
- Full Length: -1 (passing -1 means that a sceenshot of the whole web page is taken)
-
width - the width of the resulting thumbnail in pixels
- Default: if both the output width and output height are not specified or 0 then the output width and height will match the final image width and height, if the output height is specified the output width will be proportional to the output height
- Maximum: Maximum width for package
- Full Width: -1 (passing -1 means that the width of the thumbnail is not reduced)
-
height - the height of the resulting thumbnail in pixels
- Default: if both the output width and output height are not specified or 0 then the output width and height will match the final image width and height, if the output width is specified the output height will be proportional to the output width
- Maximum: Maximum height for package
- Full Height: -1 (passing -1 means that the height of the thumbnail is not reduced)
-
format - the format the screenshot should be in.
- Default: "jpg"
- Options: "bmp8", "bmp16", "bmp24", "bmp", "tiff", "webp", "jpg", "png"
-
delay - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
clickElement - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
targetElement - the CSS selector of the only HTML element on the target web page that is to be turned into a screenshot, all other parts of the web page are ignored. If there are multiple matching HTML elements the first one is chosen
-
hideElement - the CSS selectors of the one or more HTML elements in the web page to hide, to specify multiple HTML elements to hide seperate each selector with a comma
-
waitForElement - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
requestAs - the type of user agent you wish to use
- Default: 0
-
Options:
- 0 = indicates the user agent of a standard browser should be used
- 1 = indicates the user agent of a mobile browser should be used
- 2 = indicates the user agent of a search engine should be used
-
customWaterMarkId - add a custom watermark or special watermark to the image
-
quality - the quality of the returned image. This currently only effects JPG and WEBP images, which have a default compression of 90%.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
transparent - if true the image capture should be transparent. This is only compatible with png and tiff images.
-
hd - if true the image capture will be in high definition this doubles the size of the image dimensions.
-
country - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
noAds - if true adverts should be automatically hidden.
-
noCookieNotifications - if true all commonly found cookie notifications should be automatically hidden.
-
address - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
post - defines the HTTP Post querystring. Each name and value in the querystring will need to be URL encoded. Using this option will force GrabzIt to perform a HTTP post.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
Options Example
{
'width':500,
'height':500
}
url_to_video(url, options)
Specifies the URL that should be converted into a video.
Parameters
-
url - the URL that the video should be captured from
-
options - a JSON object that defines any special options to use when creating the video.
Return Value
void
html_to_video(html, options)
Specifies the HTML that the video should be captured from.
Parameters
Return Value
void
file_to_video(path, options)
Specifies a HTML file that should be converted into a video.
Parameters
-
path - the file path of a HTML file to convert into a video
-
options - a JSON object that defines any special options to use when creating the video.
Return Value
void
Video Options
All of the options available when creating a video of a webpage.
-
customId - custom identifier that you can pass through to the video webservice. This will be returned with the callback URL you have specified.
-
customWaterMarkId - add a custom watermark or special watermark to the video
-
browserWidth - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
-
BrowserHeight - the height of the browser in pixels
- Default: 1170
- Maximum: 10000
-
width - the width of the resulting video in pixels
- Default: if not set it will match the browser width
- Maximum: Maximum width for package
-
height - the height of the resulting video in pixels
- Default: if not set it will match the browser height
- Maximum: Maximum height for package
-
start - the number of milliseconds to wait before creating the video
- Default: 0
- Maximum: 30000
-
clickElement - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
waitForElement - the CSS selectors of the HTML element in the web page that must be visible before the video is rendered
-
requestAs - the type of user agent you wish to use
- Default: 0
-
Options:
- 0 = indicates the user agent of a standard browser should be used
- 1 = indicates the user agent of a mobile browser should be used
- 2 = indicates the user agent of a search engine should be used
-
country - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
noAds - if true adverts should be automatically hidden.
-
noCookieNotifications - if true all commonly found cookie notifications should be automatically hidden.
-
address - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
post - defines the HTTP Post querystring. Each name and value in the querystring will need to be URL encoded. Using this option will force GrabzIt to perform a HTTP post.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
-
framesPerSecond - the number of frames per second that should be captured from the video.
- Default: 1
- Minimum: 0.2
- Maximum: 20
-
duration - the length in seconds of the video, this will be how long the web page is captured for.
- Default: 10
- Minimum: 1
- Maximum: 60
Options Example
{
'duration':5,
'framesPerSecond':3
}
url_to_rendered_html(url, options)
Specifies the URL that should be converted into rendered HTML.
Parameters
-
url - the URL that the rendered HTML should be made of
- options - a JSON object that defines any special options to use when creating the rendered HTML.
Return Value
void
html_to_rendered_html(html, options)
Specifies the HTML that should be converted into rendered HTML.
Parameters
-
html - the HTML to convert into rendered HTML
- options - a JSON object that defines any special options to use when creating rendered HTML.
Return Value
void
file_to_rendered_html(path, options)
Specifies a HTML file that should be converted into rendered HTML.
Parameters
-
path - the file path of a HTML file to convert into rendered HTML
- options - a JSON object that defines any special options to use when creating rendered HTML.
Return Value
void
HTML Options
All of the options available when creating rendered HTML captures.
-
customId - custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified.
-
browserWidth - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
-
browserHeight - the height of the browser in pixels
- Default: 1170
- Maximum: 10000
-
delay - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
clickElement - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
waitForElement - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
requestAs - the type of user agent you wish to use
- Default: 0
-
Options:
- 0 = indicates the user agent of a standard browser should be used
- 1 = indicates the user agent of a mobile browser should be used
- 2 = indicates the user agent of a search engine should be used
-
country - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
noAds - if true adverts should be automatically hidden.
-
noCookieNotifications - if true all commonly found cookie notifications should be automatically hidden.
-
address - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
post - defines the HTTP Post querystring. Each name and value in the querystring will need to be URL encoded. Using this option will force GrabzIt to perform a HTTP post.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
Options Example
{
'country':'SG',
'delay':5000
}
url_to_pdf(url, options)
Specifies the URL that should be converted into a PDF.
Parameters
-
url - the URL that the should be converted into a PDF
- options - a JSON object that defines any special options to use when creating a PDF.
Return Value
void
html_to_pdf(html, options)
Specifies the HTML that should be converted into a PDF.
Parameters
Return Value
void
file_to_pdf(path, options)
Specifies a HTML file that should be converted into a PDF.
Parameters
-
path - the file path of a HTML file to convert into a PDF
- options - a JSON object that defines any special options to use when creating a PDF.
Return Value
void
PDF Options
All of the options available when creating PDF captures.
-
customId - a custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified.
-
includeBackground - if true the background of the web page should be included in the screenshot
-
pagesize - the page size of the PDF
- Default: "A4"
- Options: "A3", "A4", "A5", "A6", "B3", "B4", "B5", "B6", "Legal", "Letter"
-
orientation - the orientation of the PDF document
- Default: "Portrait"
- Options: "Portrait", "Landscape"
-
cssMediaType - the CSS Media Type of the PDF document
- Default: "Screen"
- Options: "Screen", "Print"
-
includeLinks - true if links should be included in the PDF
-
includeOutline - true if PDF bookmarks should be included
-
title - provide a title to the PDF document
-
coverUrl - the URL of a web page that should be used as a cover page for the PDF
-
marginTop - the margin in millimeters that should appear at the top of the PDF document page
-
marginLeft - the margin in millimeters that should appear at the left of the PDF document page
-
marginBottom - the margin in millimeters that should appear at the bottom of the PDF document page
-
marginRight - the margin in millimeters that should appear at the right of the PDF document
-
browserWidth - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
- Auto Width: -1 (passing -1 means that the width of the browser matches the width of the PDF document)
-
pageWidth - the custom width of the resulting PDF in mm
-
pageHeight - the custom height of the resulting PDF in mm
- Default: page size height
- Minimum: 15
- Full Length: -1 (passing -1 means that the page height is equal to the web page)
-
delay - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
requestAs - the type of user agent you wish to use
- Default: 0
-
Options:
- 0 = indicates the user agent of a standard browser should be used
- 1 = indicates the user agent of a mobile browser should be used
- 2 = indicates the user agent of a search engine should be used
-
templateId - add a template ID that specifies the header and footer of the PDF document
-
clickElement - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
targetElement - the CSS selector of the only HTML element on the target web page that is to be turned into a PDF, all other parts of the web page are ignored. If there are multiple matching HTML elements the first one is chosen
-
hideElement - the CSS selectors of the one or more HTML elements in the web page to hide, to specify multiple HTML elements to hide seperate each selector with a comma
-
waitForElement - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
customWaterMarkId - add a custom watermark or special watermark to each page of the PDF document
-
quality - the quality of the returned PDF. The default uses the recommended quality for the PDF.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
country - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
noAds - if true adverts should be automatically hidden.
-
noCookieNotifications - if true all commonly found cookie notifications should be automatically hidden.
-
address - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
post - defines the HTTP Post querystring. Each name and value in the querystring will need to be URL encoded. Using this option will force GrabzIt to perform a HTTP post.
-
templateVariables - defines a custom template parameter and value as a querystring. Each name and value in the querystring will need to be URL encoded.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
-
mergeId - the ID of a capture that should be merged at the beginning of the new PDF document
-
password - the password to protect the PDF document with
Options Example
{
'pagesize':'A5',
'includeLinks':true
}
url_to_docx(url, options)
Specifies the URL that should be converted into a DOCX.
Parameters
-
url - the URL that the should be converted into a DOCX
- options - a JSON object that defines any special options to use when creating a DOCX.
Return Value
void
html_to_docx(html, options)
Specifies the HTML that should be converted into a DOCX.
Parameters
Return Value
void
file_to_docx(path, options)
Specifies a HTML file that should be converted into a DOCX.
Parameters
-
path - the file path of a HTML file to convert into a DOCX
- options - a JSON object that defines any special options to use when creating a DOCX.
Return Value
void
DOCX Options
All of the options available when creating DOCX captures.
-
customId - a custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified.
-
includeBackground - if true the background images of the web page should be included in the DOCX
-
pagesize - the page size of the DOCX
- Default: "A4"
- Options: "A3", "A4", "A5", "A6", "B3", "B4", "B5", "B6", "Legal", "Letter"
-
orientation - the orientation of the DOCX document
- Default: "Portrait"
- Options: "Portrait", "Landscape"
-
includeLinks - true if links should be included in the DOCX
-
includeImages - if true the images of the web page should be included in the DOCX
-
title - provide a title to the DOCX document
-
marginTop - the margin in millimeters that should appear at the top of the DOCX document page
-
marginLeft - the margin in millimeters that should appear at the left of the DOCX document page
-
marginBottom - the margin in millimeters that should appear at the bottom of the DOCX document page
-
marginRight - the margin in millimeters that should appear at the right of the DOCX document
-
browserWidth - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
- Auto Width: -1 (passing -1 means that the width of the browser matches the width of the DOCX document)
-
pageWidth - the custom width of the resulting DOCX in mm
-
pageHeight - the custom height of the resulting DOCX in mm
-
delay - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
requestAs - the type of user agent you wish to use
- Default: 0
-
Options:
- 0 = indicates the user agent of a standard browser should be used
- 1 = indicates the user agent of a mobile browser should be used
- 2 = indicates the user agent of a search engine should be used
-
templateId - add a template ID that specifies the header and footer of the DOCX document
-
clickElement - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
targetElement - the CSS selector of the only HTML element on the target web page that is to be turned into a DOCX, all other parts of the web page are ignored. If there are multiple matching HTML elements the first one is chosen
-
hideElement - the CSS selectors of the one or more HTML elements in the web page to hide, to specify multiple HTML elements to hide seperate each selector with a comma
-
waitForElement - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
quality - the quality of the returned DOCX. The default quality of the images in the DOCX is 85%.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
country - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
noAds - if true adverts should be automatically hidden.
-
noCookieNotifications - if true all commonly found cookie notifications should be automatically hidden.
-
address - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
post - defines the HTTP Post querystring. Each name and value in the querystring will need to be URL encoded. Using this option will force GrabzIt to perform a HTTP post.
-
templateVariables - defines a custom template parameter and value as a querystring. Each name and value in the querystring will need to be URL encoded.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
-
mergeId - the ID of a capture that should be merged at the beginning of the new DOCX document
-
password - the password to protect the DOCX document with
Options Example
{
'pagesize':'A5',
'includeLinks':true
}
url_to_table(url, options)
Specifies the URL that the HTML tables should be extracted from.
Parameters
-
url - the URL to extract HTML tables from
- options - a JSON object that defines any special options to use when converting the HTML table.
Return Value
void
html_to_table(html, options)
Specifies the HTML that the HTML tables should be extracted from.
Parameters
-
html - the HTML to extract HTML tables from.
- options - a JSON object that defines any special options to use when converting the HTML table.
Return Value
void
file_to_table(path, options)
Specifies a HTML file that the HTML tables should be extracted from.
Parameters
-
path - the file path of a HTML file to extract HTML tables from.
- options - a JSON object that defines any special options to use when converting the HTML table.
Return Value
void
Table Options
All of the options available when converting HTML tables to CSV, XLSX or JSON.
-
customId - a custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified
-
tableNumberToInclude - the index of the table to be converted, were all tables in a web page are ordered from the top of the web page to bottom
-
format - the format the table should be in
- Default: "csv"
- Options: "csv", "json", "xlsx"
-
includeHeaderNames - if true header names will be included in the table
-
includeAllTables - if true all table on the web page will be extracted with each table appearing in a seperate spreadsheet sheet. Only available with the XLSX format
-
targetElement - the id of the only HTML element in the web page that should be used to extract tables from
-
requestAs - the type of user agent you wish to use
- Default: 0
-
Options:
- 0 = indicates the user agent of a standard browser should be used
- 1 = indicates the user agent of a mobile browser should be used
- 2 = indicates the user agent of a search engine should be used
-
country - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: "SG", "UK", "US"
-
exportUrl - the export URL that specifies where the capture should be exported too
-
encryptionKey - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
post - defines the HTTP Post querystring. Each name and value in the querystring will need to be URL encoded. Using this option will force GrabzIt to perform a HTTP post.
-
address - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
proxy - the HTTP proxy details the browser software should use to use to create this capture
Options Example
{
'format':'xlsx',
'includeHeaderNames':true
}
Using the callBackUrl option is the recommended method of saving a file
save(callBackUrl, oncomplete)
Save the result asynchronously and returns a unique identifier, which can be used to get the screenshot with the get_result method.
Parameters
- callBackURL - the handler the GrabzIt service should call after it has completed its work
- oncomplete(error, id) - the callback function, which is called when the id of the screenshot is retrieved. It is important to add error handling to your project.
save_to(saveToFile, oncomplete)
Save the result synchronously without using a callback URL.
Parameters
- saveToFile - the file path that capture will be saved to once it has been completed
- oncomplete(error, data) - the callback function, which is called when the screenshot has been downloaded. The data parameter contains the screenshots bytes. It is important to add error handling to your project.
get_status(id, oncomplete)
Get the current status of a GrabzIt screenshot.
Parameters
-
id - the unique identifier of the screenshot
-
oncomplete(error, status) - the callback function, which is called when the screenshot status has been retrieved. It is important to add error handling to your project.
get_cookies(domain, oncomplete)
Get all the cookies that GrabzIt is using for a particular domain. This may include user defined cookies as well. It is important to add error handling to your project.
Parameters
-
domain - the domain to return cookies for
-
oncomplete(error, cookies) - the callback function, which is called when the cookies have been retrieved. It is important to add error handling to your project.
set_cookie(name, domain, options, oncomplete)
Sets a new custom cookie on GrabzIt, if the custom cookie has the same name and domain as a global cookie the global cookie is overridden.
This can be useful if a websites functionality is controlled by cookies.
Parameters
delete_cookie(name, domain, oncomplete)
Delete a custom cookie or block a global cookie from being used
Parameters
-
name - the name of the cookie to delete
-
domain - the domain of the website to delete the cookie for
- oncomplete(error, success) - the callback function, which is called when the cookie has been set. The success parameter is true if the cookie is deleted, otherwise false. It is important to add error handling to your project.
get_watermarks()
Get all your uploaded custom watermarks
Parameters
-
oncomplete(error, watermarks) - the callback function, which is called when the watermarks have been retrieved. The watermark parameter contains a array of watermarks. It is important to add error handling to your project.
get_watermark(identifier, oncomplete)
Return your custom watermark that matches the specified identifier
Parameters
-
identifier - the identifier of a particular custom watermark you want to view
-
oncomplete(error, watermarks) - the callback function, which is called when the watermark has been retrieved. The watermarks parameter contains a watermark array. It is important to add error handling to your project.
add_watermark(identifier, path, xpos, ypos, oncomplete)
Add a new custom watermark
Parameters
-
identifier - the identifier you want to give the custom watermark. It is important that this identifier is unique.
-
path - the absolute path of the watermark on your server. For instance C:/watermark/1.png
-
xpos - the horizontal position you want the screenshot to appear at
- Required
-
Options:
- Left = 0
- Center = 1
- Right = 2
-
ypos - vertical position you want the screenshot to appear at
- Required
-
Options:
- Top = 0
- Middle = 1
- Bottom = 2
-
oncomplete(error, success) - the callback function, which is called when the watermark has been added. The success parameter is true if the watermark has bee succesfully added, otherwise false. It is important to add error handling to your project.
delete_watermark(identifier, oncomplete)
Delete a custom watermark
Parameters
-
identifier - the identifier of the custom watermark you want to delete
-
oncomplete(error, success) - the callback function, which is called when the watermark has been removed. The success parameter is true if the watermark was successfully deleted. It is important to add error handling to your project.
set_local_proxy(value)
This method enables a local proxy server to be used for all requests.
Parameters
-
value - the URL, which can include a port if required, of the proxy. Providing a null will remove any previously set proxy
use_ssl(value)
Specifies if requests to GrabzIt's API should use SSL
Parameters
-
value - if true all requests to GrabzIt's API will use SSL
create_encryption_key()
Create a cryptographically secure base 64 encryption key, 44 characters long.
decrypt(data, key)
Decrypt an encrypted capture using the provided encryption key.
Parameters
decrypt_file(path, key, oncomplete)
Decrypt an encrypted capture using the provided encryption key.
Parameters
-
path - the path of the encrypted capture
-
key - the encryption key
- oncomplete(error) - the callback function, which is called when the file is decrypted.
Result Classes
Cookie
Public Variables
- name - the cookie name
- value - the cookie value
- domain - the domain the cookie is set for
- path - the path on the domain that this cookie applies to.
- httponly - if this cookie is only valid when the website is viewed with the HTTP protocol.
- expires - the date this cookie expires
-
type - the type of cookie this is
-
Options:
- Global - this is a global cookie set by GrabzIt
- Local - this is a local cookie set by you
- Overridden - a global cookie that has been overridden by you
Status
The class representing the current status of the screenshot.
Public Variables
- processing - if true the screenshot is still being processed.
- cached - if true the screenshot is has been processed and is currently cached.
- expired - if true the screenshot is no longer on the GrabzIt system.
- message - an error message returned by the system.
WaterMark
This class represents the custom watermarks stored in GrabzIt
Public Variables
- identifier - the identifier of the watermark
- format - the format of the watermark image
-
xPosition - the x-position that the watermark appears at on the screenshot
-
Options:
- Left = 0
- Center = 1
- Right = 2
-
yPosition - the y-position that the watermark appears at on the screenshot
-
Options:
- Top = 0
- Middle = 1
- Bottom = 2