/** * @param RequestInterface $request * @return string * @throws \Exception */ public function exec(RequestInterface $request) { try { $client = new \SoapClient($this->getUrl(), array('exceptions' => 1, 'trace' => true)); $requestData = $request->getQuery('SOAP'); $requestData['auth'] = $this->getAuth(); $call = call_user_func_array(array($client, $request->getName()), $requestData); } catch (\Exception $e) { throw $e; } return json_decode($this->checkEncodeJson($call)); }
/** * @param RequestInterface $request * @return mixed * @throws \Exception */ public function exec(RequestInterface $request) { $requestData = $request->getQuery(); $requestData['auth'] = $this->getAuth(); $url = $this->getUrl() . $request->getName() . '?' . http_build_query($requestData); try { $stream = stream_context_create(array('http' => array('timeout' => 1800))); $result = file_get_contents($url, false, $stream); } catch (\Exception $e) { throw $e; } return json_decode($this->checkEncodeJson($result)); }
/** * @param RequestInterface $request * @return mixed * @throws \Exception */ public function exec(RequestInterface $request) { $requestData = $request->getQuery(); $requestData['auth'] = $this->getAuth(); $url = $this->getUrl() . $request->getName() . '?' . http_build_query($requestData); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 600); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 600); try { $result = curl_exec($curl); } catch (\Exception $e) { throw $e; } return json_decode($this->checkEncodeJson($result)); }