/** * @throws FamilySearchException * @return mixed */ public function request() { $url = $this->url . '?' . http_build_query(array('access_token' => $this->accessToken)); // Although we are using fXmlRpc to handle the XML-RPC formatting, we // can still use Guzzle as our HTTP client which is much more robust. $client = new \fXmlRpc\Client($url, new \fXmlRpc\Transport\GuzzleBridge($this->getHttpClient())); $args = func_get_args(); try { if ($args[0] == 'DataService.getUserInfo') { $response = $client->call(array_shift($args)); } else { $response = $client->call(array_shift($args), array_merge(array('key' => ''), $args)); } return $response; } catch (fXmlRpcException $e) { throw new FamilySearchException($e->getFaultString(), $e->getFaultCode()); } }
/** * @param string $method * @param array $params * * @return array * * @throws \fXmlRpc\Exception\ResponseException */ protected function call($method, array $params) { $uri = $this->getConfig('base_url') . '/xmlrpc.php'; $bridge = new \fXmlRpc\Transport\GuzzleBridge($this); $client = new \fXmlRpc\Client($uri, $bridge); // We have to nest the params in an array otherwise we get a "Wrong // number of method parameters" error. return $client->call($method, array($params)); }