Build an \Illuminate\Http\Request object.

@param string $verb
@param \Ratchet\ConnectionInterface $connection
@param \Ratchet\Wamp\Topic $topic
@param array $data
@param array|null $params
@return \Illuminate\Http\Request
3450
protected function buildRequest($verb, Connection $connection, $topic, $data = [], $params = null)
    {
        $uri = [
            'protocol'  => 'ws://',
            'host'      => $connection->WebSocket->request->getHost(),
            'port'      => ':' . config('twostream.websocket.port'),
            'path'      => '/' . trim($topic->getId(), '/') . (isset($params) ? '/' . implode('/', $params) : ''),
        ];
        $cookies = $connection->WebSocket->request->getCookies();
        array_forget($cookies, config('session.cookie')); // Make sure the normal Session Facade does not contain the client's Session.
        
        return Request::createFromBase(
            SymfonyRequest::create(
                implode($uri),
                strtoupper($verb),
                ['data' => $data], // params
                $cookies, // cookies
                [], // files
                [], // server
                null // content
            )
        );
    }
593798
public function request($verb, $params = [])
    {
        $xml = $this->getOaiResponse($verb, $params);
        return $this->responseProcessor
            ? $this->responseProcessor->process($xml) : $xml;
    }
804247
protected function sendRequest($method, $url, $data = [], $headers = [])
    {
        $this->addRequestSourceHeader($headers);
        $data['http_errors'] = false;
        $data['headers'] = $headers;
        $response = $this->http_client->request($method, $url, $data);

        return $response;
    }
1265805
public function request($verb, array $params = array())
    {
        if (! $this->url) {
            throw new RuntimeException("Cannot perform request when URL not set.  Use setUrl() method");
        }

        //Build the URL
        $params = array_merge(array('verb' => $verb), $params);
        $url = $this->url . (parse_url($this->url, PHP_URL_QUERY) ? '&' : '?') . http_build_query($params);

        //Do the request
        try {
            $resp = $this->httpAdapter->request($url);
            return $this->decodeResponse($resp);
        } catch (HttpException $e) {
            $this->checkForOaipmhException($e);
        }
    }
1250033
public function request($verb, $path, $accept, array $customCURLOptions=[])
    {

        $verb = strtoupper(
            trim(
                $verb
            )
        );

        $instantiateClass = "\\Lamoni\\RESTLyte\\RESTLyteRequest\\RESTLyteRequest{$this->getResponseType()}";

        $request = new $instantiateClass(
            $this->getServer(),
            $verb,
            $path,
            $this->getAuthCredentials(),
            $accept,
            $this->getVerifySSLPeer(),
            $this->getHTTPHeaders(),
            $customCURLOptions
        );

        return $request->getResponse();
    }
490407
public function parse($graph, $data, $format = 'jsonld', $baseUri = null)
    {
        parent::checkParseParams($graph, $data, $format, $baseUri);

        foreach ($data as $quad) {
            $subject = (string)$quad->getSubject();

            if ('_:' === substr($subject, 0, 2)) {
                $subject = $this->remapBnode($subject);
            }

            $predicate = (string)$quad->getProperty();

            if ($quad->getObject() instanceof IRI) {
                $object = [
                    'type' => 'uri',
                    'value' => (string)$quad->getObject()
                ];

                if ('_:' === substr($object['value'], 0, 2)) {
                    $object = [
                        'type' => 'bnode',
                        'value' => $this->remapBnode($object['value'])
                    ];
                }
            } else {
                $object = [
                    'type' => 'literal',
                    'value' => $quad->getObject()->getValue()
                ];

                if ($quad->getObject() instanceof LanguageTaggedString) {
                    $object['lang'] = $quad->getObject()->getLanguage();
                } else {
                    $object['datatype'] = $quad->getObject()->getType();
                }
            }

            $this->addTriple($subject, $predicate, $object);
        }
    }
552062
protected function doRequest($data = null, $options = array())
    {
        $endpoint = isset($options['endpoint']) ? $options['endpoint'] : '';
        $verb = isset($options['verb']) ? $options['verb'] : 'GET';
        $url = $this->_gatewayUrlForKey() . '/' . $endpoint;

        if (isset($this->limit) && isset($this->offset)) {
            $paging = array(
                'limit'  => $this->limit,
                'offset' => $this->offset,
            );
            $url .= '?' . http_build_query($paging);
        }

        if ($this->searchFields != null) {
            $data = $this->searchFields;
        }

        $encodedData = json_encode($data);

        $identity = array();
        if (isset($this->_config->siteId)) {
            $identity[0] = 'SiteID='.$this->_config->siteId;
        }
        if (isset($this->_config->deviceId)) {
            $identity[1] = 'DeviceID='.$this->_config->deviceId;
        }
        if (isset($this->_config->licenseId)) {
            $identity[2] = 'LicenseID='.$this->_config->licenseId;
        }

        $auth = isset($this->_config->username)
            ? $this->_config->username.':'.$this->_config->password
            : $this->_config->secretApiKey;
        $header = array(
            'Authorization: Basic '.base64_encode($auth),
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: '.strlen($encodedData),
        );

        if (isset($this->_config->username)) {
            $header[] = 'HPS-Identity: '.implode(',', $identity);
        }
        $keyType = HpsServicesConfig::KEY_TYPE_SECRET;
        // print "\n" . $encodedData;
        return $this->submitRequest($url, $header, $encodedData, $verb, $keyType);
    }
986577
protected function request(string $verb, string $uri, array $payload = [])
    {
        $response = $this->client->request($verb, $uri,
            empty($payload) ? [] : ['json' => $payload]
        );

        if (! in_array($response->getStatusCode(), [200, 201, 204])) {
            return $this->handleRequestError($response);
        }

        $responseBody = (string) $response->getBody();

        return json_decode($responseBody, true) ?: $responseBody;
    }
1147107
protected function getOaiResponse($verb, $params)
    {
        // Debug:
        $this->write(
            "Sending request: verb = {$verb}, params = " . print_r($params, true)
        );

        // Set up retry loop:
        do {
            $result = $this->sendRequest($verb, $params);
            if ($result->getStatusCode() == 503) {
                $delayHeader = $result->getHeaders()->get('Retry-After');
                $delay = is_object($delayHeader)
                    ? $delayHeader->getDeltaSeconds() : 0;
                if ($delay > 0) {
                    $this->writeLine(
                        "Received 503 response; waiting {$delay} seconds..."
                    );
                    sleep($delay);
                }
            } elseif (!$result->isSuccess()) {
                throw new \Exception('HTTP Error ' . $result->getStatusCode());
            }
        } while ($result->getStatusCode() == 503);

        // If we got this far, there was no error -- send back response.
        return $result->getBody();
    }
715437
protected function getResponse($verb, $resource, array $data = array())
    {
        $dispatcher = new RequestDispatcher();
        $request = new Request($resource);

        $this->setRequestHeaders($request);

        $this->prepareRequest($verb, $data, $request);

        $dispatcher->add($request);
        $dispatcher->execute();

        $responses = $this->getRequestContent($dispatcher);

        $this->checkResponseForErrors($responses);

        return json_decode($responses[0]->getContent());
    }
226807
public function topic($pattern, callable $factory)
    {
        if (!$this->offsetExists('sandstone.websocket.topics')) {
            throw new \LogicException(sprintf(
                'You must register Websocket server service provider (%s) in order to use %s method.',
                WebsocketServiceProvider::class,
                __METHOD__
            ));
        }

        return $this['sandstone.websocket.topics']->match($pattern, $factory);
    }
719912
private function do_request($verb, $path,  $data = Array(), $timeout = 10)
    {
        return $this->use_sockets ? $this->do_request_with_sockets($verb, $path, $data, $timeout) : $this->do_request_with_curl($verb, $path, $data, $timeout );
    }
1106537
protected function proccessRequest($url, &$params, &$data, $headers){

        $token = isset($params['access_token']) ? $params['access_token'] : '';
        $data['cuid'] = md5($token);

        if($url === $this->asrUrl){
            $data['token'] = $token;
            $data = json_encode($data);
        }else{
            $data['tok'] = $token;
        }

        unset($params['access_token']);
    }
1516
protected function sendApiCall($verb, $location)
    {
        try {
            $this->detectInvalidJsonFields();
            $response = $this->client->sendRequest($verb, $location, $this->postFields);

            $entity = $this->getItems($response->getBody());
            if (isset($entity[0])) {
                $this->setFields($entity[0]);
            }

            return $response;
        } catch (ClientException $e) {
            if ($e->getResponse() !== null) {
                $entity = $this->getItems($e->getResponse()->getBody());

                if (isset($entity[0]['validation_messages'])) {
                    throw new ValidationException(
                        $entity[0]['validation_messages'],
                        $this->postFields,
                        $e->getResponse()->getStatusCode(),
                        isset($entity[0]['errorCode']) ? $entity[0]['errorCode'] : null
                    );
                } else {
                    throw new EntityException(
                        'Exception received from api client: ' . $e->getMessage(),
                        $e->getCode(),
                        $e->getResponse()->getStatusCode(),
                        isset($entity[0]['errorCode']) ? $entity[0]['errorCode'] : null
                    );
                }
            } else {
                throw new EntityException(
                    'Exception received from api client: ' . $e->getMessage(),
                    $e->getCode()
                );
            }
        }
    }
704189
private function handlePublishEntity(ConnectionInterface $from, $data) {
    $this->logger->notice(
        "Received an entity publish! ".
          "({$data['guid']}, {$data['event']}, {$from->resourceId})"
    );

    $etype = $data['etype'];

    if (!key_exists($etype, $this->querySubs)) {
      return;
    }

    foreach ($this->querySubs[$etype] as $curQuery => $curClients) {
      $updatedClients = new \SplObjectStorage();

      if ($data['event'] === 'delete' || $data['event'] === 'update') {
        // Check if it is in any client's currents.
        foreach ($curClients as $curClient) {
          $curData = $curClients[$curClient];
          if (in_array($data['guid'], $curData['current'])) {
            // Update currents list.
            $queryArgs = unserialize($curQuery);
            $this->prepareSelectors($queryArgs);
            $queryArgs[0]['source'] = 'client';
            $queryArgs[] = ['&', 'guid' => $data['guid']];
            $token = null;
            if ($this->sessions->contains($curClient)) {
              $token = $this->sessions[$curClient];
            }
            if (class_exists('\Tilmeld\Tilmeld') && isset($token)) {
              $user = \Tilmeld\Tilmeld::extractToken($token);
              if ($user) {
                // Log in the user for access controls.
                \Tilmeld\Tilmeld::fillSession($user);
              }
            }
            $current = call_user_func_array(
                "\Nymph\Nymph::getEntity",
                $queryArgs
            );

            if (isset($current)) {
              // Notify subscriber.
              $this->logger->notice(
                  "Notifying client of update! ".
                    "({$curClient->resourceId})"
              );
              if (is_callable([$current, 'updateDataProtection'])) {
                $current->updateDataProtection();
              }
              $curClient->send(json_encode([
                'query' => $curData['query'],
                'updated' => $data['guid'],
                'data' => $current
              ]));
            } else {
              $curData['current'] = array_diff(
                  $curData['current'],
                  [$data['guid']]
              );
              $curClients[$curClient] = $curData;

              // Notify subscriber.
              $this->logger->notice(
                  "Notifying client of removal! ".
                    "({$curClient->resourceId})"
              );
              $curClient->send(json_encode([
                'query' => $curData['query'],
                'removed' => $data['guid']
              ]));
            }

            if (class_exists('\Tilmeld\Tilmeld') && isset($token)) {
              // Clear the user that was temporarily logged in.
              \Tilmeld\Tilmeld::clearSession();
            }

            $updatedClients->attach($curClient);
          }
        }
      }

      if ($data['event'] === 'create' || $data['event'] === 'update') {
        // Check if it matches the query.
        $selectors = unserialize($curQuery);
        $this->prepareSelectors($selectors);
        $options = $selectors[0];
        unset($selectors[0]);
        $entityData = $data['entity']['data'];
        $entityData['cdate'] = $data['entity']['cdate'];
        $entityData['mdate'] = $data['entity']['mdate'];
        $entitySData = [];

        if (class_exists($options['class'])
            && class_exists($data['entity']['class'])
            && $options['class']::ETYPE === $data['entity']['class']::ETYPE
            && \Nymph\Nymph::checkData(
                $entityData,
                $entitySData,
                $selectors,
                $data['guid'],
                $data['entity']['tags']
            )
          ) {
          // It does match the query.
          foreach ($curClients as $curClient) {
            if ($updatedClients->contains($curClient)) {
              // The user was already notified. (Of an update.)
              continue;
            }

            // Check that the user can access the entity.
            $queryArgs = unserialize($curQuery);
            $this->prepareSelectors($queryArgs);
            $queryArgs[0]['source'] = 'client';
            $queryArgs[] = ['&', 'guid' => $data['guid']];
            $token = null;
            if ($this->sessions->contains($curClient)) {
              $token = $this->sessions[$curClient];
            }
            if (class_exists('\Tilmeld\Tilmeld') && isset($token)) {
              $user = \Tilmeld\Tilmeld::extractToken($token);
              if ($user) {
                // Log in the user for access controls.
                \Tilmeld\Tilmeld::fillSession($user);
              }
            }
            $current = call_user_func_array(
                "\Nymph\Nymph::getEntity",
                $queryArgs
            );

            if (isset($current)) {
              // Update the currents list.
              $curData = $curClients[$curClient];
              $curData['current'][] = $data['guid'];
              $curClients[$curClient] = $curData;

              // Notify client.
              $this->logger->notice(
                  "Notifying client of new match! ".
                    "({$curClient->resourceId})"
              );
              if (is_callable([$current, 'updateDataProtection'])) {
                $current->updateDataProtection();
              }
              $curClient->send(json_encode([
                'query' => $curData['query'],
                'added' => $data['guid'],
                'data' => $current
              ]));
            }

            if (class_exists('\Tilmeld\Tilmeld') && isset($token)) {
              // Clear the user that was temporarily logged in.
              \Tilmeld\Tilmeld::clearSession();
            }
          }
        }
      }
    }
  }
608155
protected function sendRequest($verb, $params = [])
    {
        $response = $this->communicator->request($verb, $params);
        $this->checkResponseForErrors($response);
        return $response;
    }
1242401
protected function sendApiCall($verb, $location)
    {
        try {
            return parent::sendApiCall($verb, $location);
        } catch (EntityException $exception) {
            if (BackupCode\Exception::isBackupCodeException($exception)) {
                throw new BackupCode\Exception($exception);
            }

            throw $exception;
        }
    }