Skip to content

Commit e959d2a

Browse files
committed
Updated PHP API to have click functionality.
1 parent 8f4e3c1 commit e959d2a

File tree

6 files changed

+60
-5
lines changed

6 files changed

+60
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "https://grabz.it/",
66
"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.",
77
"license": "MIT",
8-
"version":"3.4.5",
8+
"version":"3.5.0",
99
"autoload": {
1010
"psr-4": {
1111
"GrabzIt\\": "lib/"

lib/GrabzItDOCXOptions.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class GrabzItDOCXOptions extends GrabzItBaseOptions
1515
private $marginRight = 10;
1616
private $requestAs = 0;
1717
private $quality = -1;
18+
private $clickElement = null;
1819
private $hideElement = null;
1920
private $waitForElement = null;
2021
private $noAds = false;
@@ -191,6 +192,22 @@ public function getTitle()
191192
return $this->title;
192193
}
193194

195+
/*
196+
Set the CSS selector of the HTML element in the web page to click.
197+
*/
198+
public function setClickElement($value)
199+
{
200+
$this->clickElement = $value;
201+
}
202+
203+
/*
204+
Get the CSS selector of the HTML element in the web page to click.
205+
*/
206+
public function getClickElement()
207+
{
208+
return $this->clickElement;
209+
}
210+
194211
/*
195212
Set the CSS selector of the only HTML element in the web page to capture.
196213
*/
@@ -478,7 +495,7 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul
478495
$this->nullToEmpty($this->hideElement)."|".$this->nullToEmpty($this->getExportURL())."|".$this->nullToEmpty($this->waitForElement)."|".
479496
$this->nullToEmpty($this->getEncryptionKey())."|".$this->nullToEmpty(intval($this->noAds))."|".$this->nullToEmpty($this->post)."|".
480497
$this->nullToEmpty($this->targetElement)."|".$this->nullToEmpty($this->templateId)."|".$this->nullToEmpty($this->templateVariables)."|".
481-
$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);
498+
$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));
482499
}
483500

484501
public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $dataValue)
@@ -511,6 +528,7 @@ public function _getParameters($applicationKey, $sig, $callBackURL, $dataName, $
511528
$params['address'] = $this->nullToEmpty($this->address);
512529
$params['nonotify'] = $this->nullToEmpty(intval($this->noCookieNotifications));
513530
$params['password'] = $this->nullToEmpty($this->password);
531+
$params['click'] = $this->nullToEmpty($this->clickElement);
514532

515533
return $params;
516534
}

lib/GrabzItException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class GrabzItException extends \Exception {
7676
const PARAMETER_INVALID_MEDIA_TYPE = 177;
7777
const PARAMETER_INVALID_PASSWORD = 178;
7878
const PARAMETER_INVALID_MERGE = 179;
79+
const PARAMETER_INVALID_CLICK_VALUE = 180;
7980
const NETWORK_SERVER_OFFLINE = 200;
8081
const NETWORK_GENERAL_ERROR = 201;
8182
const NETWORK_DDOS_ATTACK = 202;

lib/GrabzItImageOptions.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class GrabzItImageOptions extends GrabzItBaseOptions
1111
private $width = null;
1212
private $height = null;
1313
private $format = null;
14+
private $clickElement = null;
1415
private $targetElement = null;
1516
private $hideElement = null;
1617
private $waitForElement = null;
@@ -99,6 +100,22 @@ public function getFormat()
99100
{
100101
return $this->format;
101102
}
103+
104+
/*
105+
Set the CSS selector of the HTML element in the web page to click.
106+
*/
107+
public function setClickElement($value)
108+
{
109+
$this->clickElement = $value;
110+
}
111+
112+
/*
113+
Get the CSS selector of the HTML element in the web page to click.
114+
*/
115+
public function getClickElement()
116+
{
117+
return $this->clickElement;
118+
}
102119

103120
/*
104121
Set the CSS selector of the only HTML element in the web page to capture.
@@ -323,7 +340,7 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul
323340
."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->getCustomId())."|".$this->nullToEmpty($this->delay)."|".$this->nullToEmpty($this->targetElement)
324341
."|".$this->nullToEmpty($this->customWaterMarkId)."|".$this->nullToEmpty(intval($this->requestAs))."|".$this->nullToEmpty($this->getCountry())."|".
325342
$this->nullToEmpty($this->quality)."|".$this->nullToEmpty($this->hideElement)."|".$this->nullToEmpty($this->getExportURL())."|".
326-
$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));
343+
$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);
327344
}
328345

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

351369
return $params;
352370
}

lib/GrabzItPDFOptions.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class GrabzItPDFOptions extends GrabzItBaseOptions
1818
private $templateId = null;
1919
private $customWaterMarkId = null;
2020
private $quality = -1;
21+
private $clickElement = null;
2122
private $targetElement = null;
2223
private $hideElement = null;
2324
private $waitForElement = null;
@@ -227,6 +228,22 @@ public function getCoverURL()
227228
return $this->coverURL;
228229
}
229230

231+
/*
232+
Set the CSS selector of the HTML element in the web page to click.
233+
*/
234+
public function setClickElement($value)
235+
{
236+
$this->clickElement = $value;
237+
}
238+
239+
/*
240+
Get the CSS selector of the HTML element in the web page to click.
241+
*/
242+
public function getClickElement()
243+
{
244+
return $this->clickElement;
245+
}
246+
230247
/*
231248
Set the CSS selector of the only HTML element in the web page to capture.
232249
*/
@@ -531,7 +548,7 @@ public function _getSignatureString($applicationSecret, $callBackURL, $url = nul
531548
$this->nullToEmpty($this->waitForElement)."|".$this->nullToEmpty($this->getEncryptionKey())."|".$this->nullToEmpty(intval($this->noAds))."|".
532549
$this->nullToEmpty($this->post)."|".$this->nullToEmpty($this->browserWidth)."|".$this->nullToEmpty($this->height)."|".$this->nullToEmpty($this->width)."|".
533550
$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)."|".
534-
$this->nullToEmpty($this->password);
551+
$this->nullToEmpty($this->password)."|".$this->nullToEmpty($this->clickElement);
535552
}
536553

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

571589
return $params;
572590
}

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GrabzIt 3.4
1+
GrabzIt 3.5
22
===========
33

44
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.

0 commit comments

Comments
 (0)