public function RequestFactory::fromParts

Create a request from URL parts as returned from parse_url()

Parameters

string $method HTTP method (GET, POST, PUT, HEAD, DELETE, etc):

array $urlParts URL parts containing the same keys as parse_url():

  • scheme: e.g. http
  • host: e.g. www.guzzle-project.com
  • port: e.g. 80
  • user: e.g. michael
  • pass: e.g. rocks
  • path: e.g. / OR /index.html
  • query: after the question mark ?

array|Collection $headers HTTP headers:

string|resource|array|EntityBodyInterface $body Body to send in the request:

string $protocol Protocol (HTTP, SPYDY, etc):

string $protocolVersion 1.0, 1.1, etc:

Return value

RequestInterface

Overrides RequestFactoryInterface::fromParts

1 call to RequestFactory::fromParts()
RequestFactory::fromMessage in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/RequestFactory.php
Create a new request based on an HTTP message

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/RequestFactory.php, line 74

Class

RequestFactory
Default HTTP request factory used to create the default {

Namespace

Guzzle\Http\Message

Code

public function fromParts($method, array $urlParts, $headers = null, $body = null, $protocol = 'HTTP', $protocolVersion = '1.1') {
  return $this
    ->create($method, Url::buildUrl($urlParts, true), $headers, $body)
    ->setProtocolVersion($protocolVersion);
}