EkomiServiceGETService

Class CURLService.

Defined (1)

The class is defined in the following location(s).

/includes/libraries/Ekomi/Service/GETService.php  
  1. class GETService extends Service 
  2. public $url = 'http://api.ekomi.de/v3/'; 
  3.  
  4. /** 
  5. * @param RequestInterface $request 
  6. * @return mixed 
  7. * @throws \Exception 
  8. */ 
  9. public function exec(RequestInterface $request) 
  10. $requestData = $request->getQuery(); 
  11. $requestData['auth'] = $this->getAuth(); 
  12.  
  13. $url = $this->getUrl() . $request->getName() . '?' . http_build_query($requestData); 
  14.  
  15. try { 
  16. $stream = stream_context_create(array('http'=> 
  17. array( 
  18. 'timeout' => 1800,  
  19. )); 
  20.  
  21. $result = file_get_contents($url, false, $stream); 
  22. catch (\Exception $e) { 
  23. throw $e; 
  24.  
  25. return json_decode($this->checkEncodeJson($result));