public function __construct($url) { parent::__construct($url); $urlObject = new Url($url); if ($urlObject->host == 'www.youtube.com') { $this->idString = $urlObject->getParam('v'); return; } if ($urlObject->host == 'youtu.be') { $this->idString = ltrim($urlObject->path, '/'); return; } throw new ExitException('Ссылку можно использовать только youtube.com, youtu.be'); }
public function auth22() { $defaultParams = ['client_id' => $this->clientId, 'response_type' => 'code', 'redirect_uri' => 'http://c.galaxysss.ru/yandexMoney']; if (!empty($this->scope)) { $defaultParams['scope'] = $this->scope; } $params = $this->sendRequest2('POST', $this->authUrl, $defaultParams, []); $url = new Url($params[1]['redirect_url']); $code = $url->getParam('requestid'); $defaultParams = ['code' => $code, 'client_id' => $this->clientId, 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://c.galaxysss.ru/yandexMoney']; $params = $this->sendRequest2('POST', $this->tokenUrl, $defaultParams, []); \cs\services\VarDumper::dump($params); }