Пример #1
0
 public function testLinkFunctions()
 {
     $link = new Link($this->link);
     $this->assertEquals('www.moviman.com', $link->getHost());
     $this->assertEquals('/firstpath/secondpath/image.jpg', $link->getPath());
     $this->assertEquals(33, $link->getQueryParameter('code'));
     $link->addQueryParameter('data', 'myData');
     $this->assertEquals('myData', $link->getQueryParameter('data'));
     $link->removeQueryParameter('data');
     $this->assertEquals(null, $link->getQueryParameter('data'));
     $link->addQueryParameter('data', 'myData');
     $this->assertEquals('http://*****:*****@www.moviman.com:2096/firstpath/secondpath/image.jpg?code=33&link=44&data=myData#my_format', (string) $link);
 }
Пример #2
0
 private function exchangeCodeForAccessToken()
 {
     $link = new Link(Graph::getGraphUrl('oauth/access_token'));
     $link->addQueryParameter('client_id', $this->config->getAppID());
     $link->addQueryParameter('client_secret', $this->config->getAppSecret());
     $link->addQueryParameter('code', $this->getCode());
     $link->addQueryParameter('redirect_uri', $this->getRedirectUrl());
     $request = new RequestMaker(Method::METHOD_GET, $link);
     $request->setSecurityCertificate(__DIR__ . '/Certificates/DigiCertHighAssuranceEVRootCA.pem');
     $transporter = $this->getTransporter($request);
     $transporter->send();
     $this->response = $transporter->getResponse();
     $this->responseData = json_decode($this->response->getBody());
 }
Пример #3
0
 private function getApiUrl($path, $getParameters = [])
 {
     $link = new Link(self::TWITTER_API_URL . '/' . self::TWITTER_API_VERSION . '/' . $path . '.json');
     if ($getParameters) {
         foreach ($getParameters as $key => $value) {
             $link->addQueryParameter($key, $value);
         }
     }
     return $link;
 }
Пример #4
0
 public function requestAuthorization()
 {
     $link = new Link($this->resourceOwnerAuthorizationUrl);
     $link->addQueryParameter('oauth_token', $this->temporalTokenKey);
     header('Location: ' . $link);
 }
Пример #5
0
 public function requestAuthorization()
 {
     $link = new Link('https://api.twitter.com/oauth/authorize');
     $link->addQueryParameter('oauth_token', isset($this->responseData['oauth_token']) ? $this->responseData['oauth_token'] : null);
     header('Location: ' . $link);
 }