Skip to content

Commit

Permalink
Updated PHP API to have click functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabzIt committed Aug 3, 2021
1 parent 8f4e3c1 commit e959d2a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://grabz.it/",
"description": "Use our API to allow your app to create images, DOCX documents, rendered HTML and PDF's from URL's or raw HTML. Additionally GrabzIt allows you to convert online videos into animated GIF's or HTML tables into CSV's.",
"license": "MIT",
"version":"3.4.5",
"version":"3.5.0",
"autoload": {
"psr-4": {
"GrabzIt\\": "lib/"
Expand Down
20 changes: 19 additions & 1 deletion lib/GrabzItDOCXOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class GrabzItDOCXOptions extends GrabzItBaseOptions
private $marginRight = 10;
private $requestAs = 0;
private $quality = -1;
private $clickElement = null;
private $hideElement = null;
private $waitForElement = null;
private $noAds = false;
Expand Down Expand Up @@ -191,6 +192,22 @@ public function getTitle()
return $this->title;
}

/*
Set the CSS selector of the HTML element in the web page to click.
*/
public function setClickElement($value)
{
$this->clickElement = $value;
}

/*
Get the CSS selector of the HTML element in the web page to click.
*/
public function getClickElement()
{
return $this->clickElement;
}

/*
Set the CSS selector of the only HTML element in the web page to capture.
*/
Expand Down Expand Up @@ -478,7 +495,7 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul
$this->nullToEmpty($this->hideElement)."|".$this->nullToEmpty($this->getExportURL())."|".$this->nullToEmpty($this->waitForElement)."|".
$this->nullToEmpty($this->getEncryptionKey())."|".$this->nullToEmpty(intval($this->noAds))."|".$this->nullToEmpty($this->post)."|".
$this->nullToEmpty($this->targetElement)."|".$this->nullToEmpty($this->templateId)."|".$this->nullToEmpty($this->templateVariables)."|".
$this->nullToEmpty($this->height)."|".$this->nullToEmpty($this->width)."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->getProxy())."|".$this->nullToEmpty($this->mergeId)."|".$this->nullToEmpty($this->address)."|".$this->nullToEmpty(intval($this->noCookieNotifications))."|".$this->nullToEmpty($this->password);
$this->nullToEmpty($this->height)."|".$this->nullToEmpty($this->width)."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->getProxy())."|".$this->nullToEmpty($this->mergeId)."|".$this->nullToEmpty($this->address)."|".$this->nullToEmpty(intval($this->noCookieNotifications))."|".$this->nullToEmpty($this->password."|".$this->nullToEmpty($this->clickElement));
}

public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $dataValue)
Expand Down Expand Up @@ -511,6 +528,7 @@ public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $
$params['address'] = $this->nullToEmpty($this->address);
$params['nonotify'] = $this->nullToEmpty(intval($this->noCookieNotifications));
$params['password'] = $this->nullToEmpty($this->password);
$params['click'] = $this->nullToEmpty($this->clickElement);

return $params;
}
Expand Down
1 change: 1 addition & 0 deletions lib/GrabzItException.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class GrabzItException extends \Exception {
const PARAMETER_INVALID_MEDIA_TYPE = 177;
const PARAMETER_INVALID_PASSWORD = 178;
const PARAMETER_INVALID_MERGE = 179;
const PARAMETER_INVALID_CLICK_VALUE = 180;
const NETWORK_SERVER_OFFLINE = 200;
const NETWORK_GENERAL_ERROR = 201;
const NETWORK_DDOS_ATTACK = 202;
Expand Down
20 changes: 19 additions & 1 deletion lib/GrabzItImageOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class GrabzItImageOptions extends GrabzItBaseOptions
private $width = null;
private $height = null;
private $format = null;
private $clickElement = null;
private $targetElement = null;
private $hideElement = null;
private $waitForElement = null;
Expand Down Expand Up @@ -99,6 +100,22 @@ public function getFormat()
{
return $this->format;
}

/*
Set the CSS selector of the HTML element in the web page to click.
*/
public function setClickElement($value)
{
$this->clickElement = $value;
}

/*
Get the CSS selector of the HTML element in the web page to click.
*/
public function getClickElement()
{
return $this->clickElement;
}

/*
Set the CSS selector of the only HTML element in the web page to capture.
Expand Down Expand Up @@ -323,7 +340,7 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul
."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->getCustomId())."|".$this->nullToEmpty($this->delay)."|".$this->nullToEmpty($this->targetElement)
."|".$this->nullToEmpty($this->customWaterMarkId)."|".$this->nullToEmpty(intval($this->requestAs))."|".$this->nullToEmpty($this->getCountry())."|".
$this->nullToEmpty($this->quality)."|".$this->nullToEmpty($this->hideElement)."|".$this->nullToEmpty($this->getExportURL())."|".
$this->nullToEmpty($this->waitForElement)."|".$this->nullToEmpty(intval($this->transparent))."|".$this->nullToEmpty($this->getEncryptionKey())."|".$this->nullToEmpty(intval($this->noAds))."|".$this->nullToEmpty($this->post)."|".$this->nullToEmpty($this->getProxy())."|".$this->nullToEmpty($this->address)."|".$this->nullToEmpty(intval($this->noCookieNotifications))."|".$this->nullToEmpty(intval($this->hd));
$this->nullToEmpty($this->waitForElement)."|".$this->nullToEmpty(intval($this->transparent))."|".$this->nullToEmpty($this->getEncryptionKey())."|".$this->nullToEmpty(intval($this->noAds))."|".$this->nullToEmpty($this->post)."|".$this->nullToEmpty($this->getProxy())."|".$this->nullToEmpty($this->address)."|".$this->nullToEmpty(intval($this->noCookieNotifications))."|".$this->nullToEmpty(intval($this->hd))."|".$this->nullToEmpty($this->clickElement);
}

public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $dataValue)
Expand All @@ -347,6 +364,7 @@ public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $
$params['address'] = $this->nullToEmpty($this->address);
$params['nonotify'] = $this->nullToEmpty(intval($this->noCookieNotifications));
$params['hd'] = $this->nullToEmpty(intval($this->hd));
$params['click'] = $this->nullToEmpty($this->clickElement);

return $params;
}
Expand Down
20 changes: 19 additions & 1 deletion lib/GrabzItPDFOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GrabzItPDFOptions extends GrabzItBaseOptions
private $templateId = null;
private $customWaterMarkId = null;
private $quality = -1;
private $clickElement = null;
private $targetElement = null;
private $hideElement = null;
private $waitForElement = null;
Expand Down Expand Up @@ -227,6 +228,22 @@ public function getCoverURL()
return $this->coverURL;
}

/*
Set the CSS selector of the HTML element in the web page to click.
*/
public function setClickElement($value)
{
$this->clickElement = $value;
}

/*
Get the CSS selector of the HTML element in the web page to click.
*/
public function getClickElement()
{
return $this->clickElement;
}

/*
Set the CSS selector of the only HTML element in the web page to capture.
*/
Expand Down Expand Up @@ -531,7 +548,7 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul
$this->nullToEmpty($this->waitForElement)."|".$this->nullToEmpty($this->getEncryptionKey())."|".$this->nullToEmpty(intval($this->noAds))."|".
$this->nullToEmpty($this->post)."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->height)."|".$this->nullToEmpty($this->width)."|".
$this->nullToEmpty($this->templateVariables)."|".$this->nullToEmpty($this->getProxy())."|".$this->nullToEmpty($this->mergeId)."|".$this->nullToEmpty($this->address)."|".$this->nullToEmpty(intval($this->noCookieNotifications))."|".$this->nullToEmpty($this->cssMediaType)."|".
$this->nullToEmpty($this->password);
$this->nullToEmpty($this->password)."|".$this->nullToEmpty($this->clickElement);
}

public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $dataValue)
Expand Down Expand Up @@ -567,6 +584,7 @@ public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $
$params['nonotify'] = $this->nullToEmpty(intval($this->noCookieNotifications));
$params['media'] = $this->nullToEmpty($this->cssMediaType);
$params['password'] = $this->nullToEmpty($this->password);
$params['click'] = $this->nullToEmpty($this->clickElement);

return $params;
}
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GrabzIt 3.4
GrabzIt 3.5
===========

This library allows you to programmatically convert HTML and URL's into images, DOCX documents, rendered HTML, PDF's, CSV's, spreadsheets and JSON. Additionally GrabzIt allows you to convert online videos into animated GIF's.
Expand Down

0 comments on commit e959d2a

Please sign in to comment.