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;
}