Get a HTTP response containing the video.

@param array $headers HTTP headers of the request

@return Response
973700
public function getHttpResponse(array $headers = [])
    {
        $client = new Client();
        $urls = $this->getUrl();

        return $client->request('GET', $urls[0], ['stream' => true, 'headers' => $headers]);
    }
243033
protected function _getHttpStatusFromHeaders($headers)
  {
    $httpstatus = '500';
    $match      = [];
    if (!empty($headers[0]) && preg_match('/HTTP\/\d\.\d (\d{3})/', $headers[0], $match)) {
      $httpstatus = $match[1];
    }
    return $httpstatus;
  }
54001
protected function encodeHeaders(array $headers): string
    {
        $data = '';

        foreach ($headers as $name => $values) {
            foreach ($values as $value) {
                $data .= sprintf("%s: %s\r\n", $name, $this->encodeHeader($value));
            }
        }

        return $data;
    }
707408
public function get($url, array $headers = array())
    {
        curl_setopt($this->handle, CURLOPT_HTTPGET, true);

        return $this->execute($url, $headers);
    }
190211
public function createRequestFromArray(array $headers): GenericRequest
    {
        $upperCaseHeaders = [];

        foreach ($headers as $header => $value) {
            $upperCaseHeader = mb_strtoupper(str_replace('-', '_', $header));

            if (0 !== mb_strpos($upperCaseHeader, 'HTTP_')) {
                $upperCaseHeader = 'HTTP_' . $upperCaseHeader;
            }

            if (!HeaderSecurity::isValid($value)) {
                $value = $this->filterHeader($value);
            }

            $upperCaseHeaders[$upperCaseHeader] = $value;
        }

        $message = ServerRequestFactory::fromGlobals($upperCaseHeaders);

        return $this->createRequestFromPsr7Message($message);
    }
197598
public function loadMovieCollection(array $parameters = [], array $headers = [])
    {
        return $this->createCollection(
            $this->getApi()->getMovieGenres($parameters, $headers)
        );
    }
70985
public function parseHeaders(array $headers)
    {
        foreach ($headers as $key => $value) {
            if (strpos($key, 'HTTP_') !== false) {
                $newKey                 = str_replace(['http_', '_'], ['', '-'],
                    mb_strtolower($key));
                $this->headers[$newKey] = $value;
            }
        }
        return $this->headers;
    }
627248
public static function response(string $message = null, int $code = null, array $headers = [])
  {
    $rest = new Rest;
    $rest->message = $message;

    if ($headers != []) {
      foreach($headers as $field => $i) {
        array_push($rest->headers, $field .': '. $i);
      }
    }

    if ($code != null) {
      $rest->code = $code;
      header('HTTP/1.1 '.$rest->code);
      return $rest->send();
    }

    return $rest;
  }
102201
public function load(array $headers = [])
    {
        $data = $this->getApi()->getConfiguration($headers);

        return $this->getFactory()->create($data);
    }
1182440
function getResponseHeaders($options = array()){
		$options = array_merge(array(
			"as_hash" => false,
			"lowerize_keys" => false
		),$options);

		$this->fetchContent();

		$out = $this->_ResponseHeaders;

		if($options["as_hash"]){
			$headers = explode("\n",$out);
			$out = array();
			foreach($headers as $h){
				if(preg_match("/^([^ ]+):(.*)/",trim($h),$matches)){
					$key = $options["lowerize_keys"] ? strtolower($matches[1]) : $matches[1];
					$out[$key] = trim($matches[2]);
				}
			}
		}

		return $out;
	}
661576
protected function getRemoteResponse($url, array $headers = [])
    {
        $fixedHeaders = ['connection' => 'close'];
        foreach($headers as $key => $header) {
            if (is_int($key)) {
                list($key, $header) = explode(':', $header);
            }
            $key = strtolower($key);
            if (in_array($key, ['cache-control', 'accept', 'user-agent', 'accept-encoding', 'accept-language'])) {
                if (is_array($header)) {
                    $fixedHeaders[$key] = implode('; ', $header);
                }
            }
        }

        $browser = new Browser();
        /** @var \Buzz\Message\Response $res */
        $res = $browser->get($url, $fixedHeaders);
        if ($res->isSuccessful()) {
            $response = new Response($res->getContent(), $res->getStatusCode());
            $headers = [];
            foreach($res->getHeaders() as $header) {
                if (0 < strpos($header, ':')) {
                    list($key, $value) = explode(':', $header);
                    $headers[trim($key)] = trim($value);
                }
            }
            $response->headers->add($headers);
            return $response;
        }

        return null;
    }
883760
protected function jsonResponse($data = null, array $headers = array(), array $httpHeaders = array())
    {
        $headers = array_replace_recursive(array(
            'status' => array(
                'code'    => 200,
                'message' => 'OK',
            ),
            'version' => 'v1',
        ), $headers);

        $data = array(
            'headers'  => $headers,
            'response' => $data,
        );

        // Debug data
        if (Config::get('app.debug', false) && Input::get('debug', false) == true) {
            $data['debug'] = $this->debugDatas();
        }

        $response = Response::make(json_encode($data), $headers['status']['code']);

        // HTTP headers
        foreach ($httpHeaders as $k => $v) {
            $response->header($k, $v);
        }
        $response
            ->header('Content-Type', 'application/json')
            ->setEtag(md5(json_encode($data)))
        ;

        return $response;
    }
505703
public function getMovieList(array $parameters = [], array $headers = [])
    {
        $data  = $this->getApi()->getMovieList($this->parseQueryParameters($parameters), $headers);

        return $this->getFactory()->createCollection($data);
    }
1152844
public function loadTvCollection(array $parameters = [], array $headers = [])
    {
        return $this->createCollection(
            $this->getApi()->getTvGenres($parameters, $headers)
        );
    }
136837
public function parseReturnHeaders($headers)
    {
        $head = [];
        foreach ($headers as $k => $v) {
            $t = explode(':', $v, 2);
            if (isset($t[1])) {
                $head[trim($t[0])] = trim($t[1]);
            } else {
                $head[] = $v;
                if (preg_match("#HTTP/[0-9\.]+\s+([0-9]+)#", $v, $out)) {
                    $head['reponse_code'] = intval($out[1]);
                }
            }
        }
        $this->debug->debug(__FUNCTION__, 'Response Header: ', $head);

        return $head;
    }
212304
public function getResponseHandshake($key, array $headers = [])
    {
        $headers = array_merge(
            $this->getSuccessResponseHeaders(
                $key
            ),
            $headers
        );

        return $this->getHttpResponse(self::HTTP_SWITCHING_PROTOCOLS, $headers);
    }
468849
public function get($uri, array $headers = [])
	{
		return $this->sendRequest(
			$this->message->createRequest('GET', $uri, $headers, null)
		);
	}