37 lines
917 B
PHP
37 lines
917 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace VK\API\Traits;
|
|
|
|
use VK\Browsers\BrowserAbstract;
|
|
use Exception;
|
|
/**
|
|
* Паттерн registry
|
|
*/
|
|
trait Request
|
|
{
|
|
private static function request(string $method, array $params, BrowserAbstract $browser)
|
|
{
|
|
$url = 'https://api.vk.com/method/' . $method;
|
|
|
|
foreach ($params as $key => $value) {
|
|
$post[$key] = $value;
|
|
}
|
|
|
|
// while (True) {
|
|
// try {
|
|
return $browser::post($url, $post);
|
|
// } catch (Exception $e) {
|
|
// // if (in_array($e->getCode(), $this->request_ignore_error)) {
|
|
// // sleep(1);
|
|
// // continue;
|
|
// // } else
|
|
// // throw new Exception($e->getMessage(), $e->getCode());
|
|
// throw new Exception('Жопа');
|
|
// }
|
|
// }
|
|
return false;
|
|
}
|
|
}
|