1 | <?php |
||
14 | class Client extends GenericClient |
||
15 | { |
||
16 | const STATUS_OK_REPORT_RECORDED = 'OK_REPORT_RECORDED'; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $serverBaseUri = 'http://rucaptcha.com'; |
||
22 | |||
23 | /** |
||
24 | * Your application ID in Rucaptcha catalog. |
||
25 | * The value `1013` is ID of this library. Set in false if you want to turn off sending any ID. |
||
26 | * @see https://rucaptcha.com/software/view/php-api-client |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $softId = '1013'; |
||
30 | |||
31 | /** |
||
32 | * @inheritdoc |
||
33 | */ |
||
34 | public function sendCaptcha($content, array $extra = []) |
||
41 | |||
42 | /** |
||
43 | * Bulk captcha result. |
||
44 | * |
||
45 | * @param int[] $captchaIds # Captcha task Ids array |
||
46 | * @return string[] # Array $captchaId => $captchaText or false if is not ready |
||
47 | * @throws RuntimeException |
||
48 | */ |
||
49 | public function getCaptchaResultBulk(array $captchaIds) |
||
73 | |||
74 | /** |
||
75 | * Returns balance of account. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getBalance() |
||
84 | |||
85 | /** |
||
86 | * Report of wrong recognition. |
||
87 | * |
||
88 | * @param $captchaId |
||
89 | * @return bool |
||
90 | * @throws RuntimeException |
||
91 | */ |
||
92 | public function badCaptcha($captchaId) |
||
105 | |||
106 | /** |
||
107 | * Returns server health data. |
||
108 | * |
||
109 | * @param string|string[] $paramsList # List of metrics to be returned |
||
110 | * @return array # Array of load metrics $metric => $value formatted |
||
111 | */ |
||
112 | public function getLoad($paramsList = ['waiting', 'load', 'minbid', 'averageRecognitionTime']) |
||
128 | |||
129 | /** |
||
130 | * Returns load data as XML. |
||
131 | * |
||
132 | * @return \SimpleXMLElement |
||
133 | */ |
||
134 | public function getLoadXml() |
||
142 | |||
143 | /** |
||
144 | * @param string $captchaId # Captcha task ID |
||
145 | * @return array | false # Solved captcha and cost array or false if captcha is not ready |
||
146 | * @throws RuntimeException |
||
147 | */ |
||
148 | public function getCaptchaResultWithCost($captchaId) |
||
171 | |||
172 | /** |
||
173 | * @param string $url |
||
174 | * @return bool # true if added and exception if fail |
||
175 | * @throws RuntimeException |
||
176 | */ |
||
177 | public function addPingback($url) |
||
190 | |||
191 | /** |
||
192 | * @return string[] |
||
193 | * @throws RuntimeException |
||
194 | */ |
||
195 | public function getPingbacks() |
||
211 | |||
212 | /** |
||
213 | * @param string $uri |
||
214 | * @return bool |
||
215 | * @throws RuntimeException |
||
216 | */ |
||
217 | public function deletePingback($uri) |
||
230 | |||
231 | /** |
||
232 | * @return bool |
||
233 | * @throws RuntimeException |
||
234 | */ |
||
235 | public function deleteAllPingbacks() |
||
239 | } |
||
240 |