FacebookRestClient::call_method PHP Method

call_method() public method

* UTILITY FUNCTIONS
public call_method ( $method, $params )
    public function call_method($method, $params)
    {
        $xml = $this->post_request($method, $params);
        $sxml = simplexml_load_string($xml);
        $result = self::convert_simplexml_to_array($sxml);
        if ($GLOBALS['facebook_config']['debug']) {
            // output the raw xml and its corresponding php object, for debugging:
            print '<div style="margin: 10px 30px; padding: 5px; border: 2px solid black; background: gray; color: white; font-size: 12px; font-weight: bold;">';
            $this->cur_id++;
            print $this->cur_id . ': Called ' . $method . ', show ' . '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'params\');">Params</a> | ' . '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'xml\');">XML</a> | ' . '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'sxml\');">SXML</a> | ' . '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'php\');">PHP</a>';
            print '<pre id="params' . $this->cur_id . '" style="display: none; overflow: auto;">' . print_r($params, true) . '</pre>';
            print '<pre id="xml' . $this->cur_id . '" style="display: none; overflow: auto;">' . htmlspecialchars($xml) . '</pre>';
            print '<pre id="php' . $this->cur_id . '" style="display: none; overflow: auto;">' . print_r($result, true) . '</pre>';
            print '<pre id="sxml' . $this->cur_id . '" style="display: none; overflow: auto;">' . print_r($sxml, true) . '</pre>';
            print '</div>';
        }
        if (is_array($result) && isset($result['error_code'])) {
            throw new FacebookRestClientException($result['error_msg'], $result['error_code']);
        }
        return $result;
    }

Usage Example

 /**
  * For every invocation we need to figure where the call
  * should go.  For example a rating service should be redirected to the
  * rating service.
  *
  * @param unknown_type $method
  * @param unknown_type $params
  * @return unknown
  */
 public function call_method($method, $params)
 {
     $stack = explode(".", $method);
     $this->setNamespace($stack[0]);
     $result = parent::call_method($method, $params);
     return $result;
 }
All Usage Examples Of FacebookRestClient::call_method