forked from AdminAnticaptcha/anticaptcha-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added hCaptchaTask and squareNetTask
- Loading branch information
Anti Admin
committed
Mar 27, 2020
1 parent
a5ca0b2
commit f452cd5
Showing
3 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
class HCaptcha extends Anticaptcha implements AntiCaptchaTaskProtocol { | ||
|
||
private $websiteUrl; | ||
private $websiteKey; | ||
private $proxyType = "http"; | ||
private $proxyAddress; | ||
private $proxyPort; | ||
private $proxyLogin; | ||
private $proxyPassword; | ||
private $userAgent = ""; | ||
private $cookies = ""; | ||
|
||
public function getPostData() { | ||
return array( | ||
"type" => "NoCaptchaTask", | ||
"websiteURL" => $this->websiteUrl, | ||
"websiteKey" => $this->websiteKey, | ||
"proxyType" => $this->proxyType, | ||
"proxyAddress" => $this->proxyAddress, | ||
"proxyPort" => $this->proxyPort, | ||
"proxyLogin" => $this->proxyLogin, | ||
"proxyPassword" => $this->proxyPassword, | ||
"userAgent" => $this->userAgent, | ||
"cookies" => $this->cookies | ||
); | ||
} | ||
|
||
public function setTaskInfo($taskInfo) { | ||
$this->taskInfo = $taskInfo; | ||
} | ||
|
||
public function getTaskSolution() { | ||
return $this->taskInfo->solution->gRecaptchaResponse; | ||
} | ||
|
||
public function setWebsiteURL($value) { | ||
$this->websiteUrl = $value; | ||
} | ||
|
||
public function setWebsiteKey($value) { | ||
$this->websiteKey = $value; | ||
} | ||
|
||
public function setProxyType($value) { | ||
$this->proxyType = $value; | ||
} | ||
|
||
public function setProxyAddress($value) { | ||
$this->proxyAddress = $value; | ||
} | ||
|
||
public function setProxyPort($value) { | ||
$this->proxyPort = $value; | ||
} | ||
|
||
public function setProxyLogin($value) { | ||
$this->proxyLogin = $value; | ||
} | ||
|
||
public function setProxyPassword($value) { | ||
$this->proxyPassword = $value; | ||
} | ||
|
||
public function setUserAgent($value) { | ||
$this->userAgent = $value; | ||
} | ||
|
||
public function setCookies($value) { | ||
$this->cookies = $value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
class HCaptchaProxyless extends Anticaptcha implements AntiCaptchaTaskProtocol { | ||
|
||
private $websiteUrl; | ||
private $websiteKey; | ||
|
||
public function getPostData() { | ||
return array( | ||
"type" => "HCaptchaTaskProxyless", | ||
"websiteURL" => $this->websiteUrl, | ||
"websiteKey" => $this->websiteKey | ||
); | ||
} | ||
|
||
public function setTaskInfo($taskInfo) { | ||
$this->taskInfo = $taskInfo; | ||
} | ||
|
||
public function getTaskSolution() { | ||
return $this->taskInfo->solution->gRecaptchaResponse; | ||
} | ||
|
||
public function setWebsiteURL($value) { | ||
$this->websiteUrl = $value; | ||
} | ||
|
||
public function setWebsiteKey($value) { | ||
$this->websiteKey = $value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
class SquareCaptcha extends Anticaptcha implements AntiCaptchaTaskProtocol { | ||
|
||
private $body; | ||
private $objectName = ""; | ||
private $rowsCount = 3; | ||
private $columnsCount = 3; | ||
|
||
|
||
public function getPostData() { | ||
return array( | ||
"type" => "SquareNetTask", | ||
"body" => str_replace("\n", "", $this->body), | ||
"objectName" => $this->objectName, | ||
"rowsCount" => $this->rowsCount, | ||
"columnsCount" => $this->columnsCount | ||
); | ||
} | ||
|
||
public function setTaskInfo($taskInfo) { | ||
$this->taskInfo = $taskInfo; | ||
} | ||
|
||
public function getTaskSolution() { | ||
return $this->taskInfo->solution->cellNumbers; | ||
} | ||
|
||
public function setFile($fileName) { | ||
|
||
if (file_exists($fileName)) { | ||
|
||
if (filesize($fileName) > 100) { | ||
$this->body = base64_encode(file_get_contents($fileName)); | ||
return true; | ||
} else { | ||
$this->setErrorMessage("file $fileName too small or empty"); | ||
} | ||
|
||
} else { | ||
$this->setErrorMessage("file $fileName not found"); | ||
} | ||
return false; | ||
|
||
} | ||
|
||
public function setObjectName($value) { | ||
$this->objectName = $value; | ||
} | ||
|
||
public function setRowsCount($value) { | ||
$this->rowsCount = $value; | ||
} | ||
|
||
public function setColumnsCount($value) { | ||
$this->columnsCount = $value; | ||
} | ||
|
||
} |