Beispiel #1
0
 /**
  * Send a request to Graph with an app access token.
  *
  * @param string $endpoint
  * @param array $params
  * @param string|null $appId
  * @param string|null $appSecret
  *
  * @return \Facebook\FacebookResponse
  *
  * @throws FacebookRequestException
  */
 protected static function request($endpoint, array $params, $appId = null, $appSecret = null)
 {
     $targetAppId = FacebookSession::_getTargetAppId($appId);
     $targetAppSecret = FacebookSession::_getTargetAppSecret($appSecret);
     if (!isset($params['client_id'])) {
         $params['client_id'] = $targetAppId;
     }
     if (!isset($params['client_secret'])) {
         $params['client_secret'] = $targetAppSecret;
     }
     // The response for this endpoint is not JSON, so it must be handled
     //   differently, not as a GraphObject.
     $request = new FacebookRequest(FacebookSession::newAppSession($targetAppId, $targetAppSecret), 'GET', $endpoint, $params);
     return $request->execute();
 }
 /**
  * Initialize the helper and process available signed request data.
  *
  * @param string|null $appId
  * @param string|null $appSecret
  */
 public function __construct($appId = null, $appSecret = null)
 {
     $this->appId = FacebookSession::_getTargetAppId($appId);
     $this->appSecret = FacebookSession::_getTargetAppSecret($appSecret);
     $this->instantiateSignedRequest();
 }