PHP PHP SDK для Graph API - PullRequest
       3

PHP PHP SDK для Graph API

0 голосов
/ 08 августа 2011

Можно ли распечатать в моих файлах журнала точный запрос из Facebook PHP SDK на сервер графиков Facebook?

Может кто-нибудь объяснить мне, как изменить библиотеку PHP Facebook https://github.com/facebook/php-sdk

Я нашел:

/**
* Invoke the Graph API.
*
* @param String $path the path (required)
* @param String $method the http method (default 'GET')
* @param Array $params the query/post data
* @return the decoded response object
* @throws FacebookApiException
*/
protected function _graph($path, $method = 'GET', $params = array()) {
if (is_array($method) && empty($params)) {
  $params = $method;
  $method = 'GET';
}
$params['method'] = $method; // method override as we always do a POST

$result = json_decode($this->_oauthRequest(
  $this->getUrl('graph', $path),
  $params
), true);

// results are returned, errors are thrown
if (is_array($result) && isset($result['error'])) {
  $this->throwAPIException($result);
}

return $result;
}

1 Ответ

1 голос
/ 08 августа 2011

Вам лучше взглянуть на функцию makeRequest, в которой происходит фактический http-запрос.Поскольку я не буду играть в API, вы также можете расширить класс и переопределить метод:

class FacebookLogger extends Facebook {

    protected function makeRequest($url, $params, $ch=null) {

        var_dump($url);
        var_dump($params);

        parent::makeRequest($url, $params, $ch);

    }

}
...