/** * @param $signedData * @param $username * @param $host * @return mixed[] * @throws KikSDKException */ public function decryptPayload($signedData, $username, $host) { $request = new Request(); $request->setUrl($this->apiUrl . 'verification/v1/check'); $request->setParameters(array('u' => $username, 'd' => $host, 'debug' => $this->debug ? 'true' : 'false')); $request->setBody($signedData); $request->setHeader('Content-Type', 'text/plain'); $httpClient = Client::getInstance(); $response = $httpClient->post($request); if (!$response) { throw new KikSDKException("Could not reach server"); } return $response->getBody(); }
protected function setAdditionalParameters(DeligatedUser $user) { $steamKey = Config::get('accounts.steam.key'); if ($steamKey) { $openid = $user->getUniqueId(); $params = explode('/', $openid); $id = array_pop($params); // Now fetch the user data $request = new Request(); $request->setUrl('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/'); $request->setParameters(array('key' => $steamKey, 'steamids' => $id)); $response = Client::getInstance()->get($request); // No headers? No gain. $data = json_decode($response->getBody(), true); if ($data) { $userdata = $data['response']['players'][0]; $user->setName($userdata['personaname']); $user->setAvatar($userdata['avatarfull']); $user->setFirstname($userdata['realname']); $user->setUrl($userdata['profileurl']); } } }
/** * Proxy a request. * @param string|Request $request Url or Request object. * @return Response */ public static function proxy($request) { if (!$request instanceof Request) { $url = $request; $request = new Request(); $request->setUrl($url); $request->setMethod(Request::METHOD_GET); } return Client::getInstance()->process($request); }