0

Is it possible to print to my log files the exact request from Facebook PHP SDK to the Facebook Graphs Server?

Can someone explain me how to modify the Facebook PHP Library https://github.com/facebook/php-sdk

I found:

/** * 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 Answer 1

1

You should rather have a look at the makeRequest function where the actual http request takes place. Since I wouldn't play around in the api, you could also extend the class and override the method:

class FacebookLogger extends Facebook { protected function makeRequest($url, $params, $ch=null) { var_dump($url); var_dump($params); parent::makeRequest($url, $params, $ch); } } 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot mate. Where should I put this ? inside facebook.php or base_facebook.php or maybe in my code?
create a new file (e.g. fb_logger.php), include it (and the official fb api) and instead of new Facebook write new FacebookLogger.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.