Пример #1
0
 /**
  * Send the request to Here
  *
  * @param HereRequest $request
  *
  * @return HereResponse
  * @throws HereSDKException
  */
 public function send(HereRequest $request)
 {
     $options = ['http' => ['method' => 'GET', 'timeout' => 30, 'ignore_errors' => true], 'ssl' => ['verify_peer' => false]];
     $this->stream->streamContextCreate($options);
     $rawBody = $this->stream->fileGetContents($request->buildRequestUrl());
     $rawHeaders = $this->stream->getResponseHeaders();
     if ($rawBody === false || empty($rawHeaders)) {
         throw new HereSDKException('Stream returned an empty response', 100);
     }
     $rawHeaders = implode("\r\n", $rawHeaders);
     // TODO Return a HereResponse
 }
Пример #2
0
 public function openConnection()
 {
     $options = [CURLOPT_URL => $this->request->buildRequestUrl(), CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 30, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false];
     $this->curl->init();
     $this->curl->setoptArray($options);
 }