WireHttp::get() method

Send a GET request to URL

Example

$http = new WireHttp();
$response = $http->get("http://domain.com/path/", [
  'foo' => 'bar',
]);
if($response !== false) {
  echo "Successful response: " . $sanitizer->entities($response);
} else {
  echo "HTTP request failed: " . $http->getError();
}

Usage

// basic usage
$bool = $http->get(string $url);

// usage with all arguments
$bool = $http->get(string $url, $data = [], array $options = []);

Arguments

NameType(s)Description
urlstring

URL to send request to (including http:// or https://)

data (optional)array, string

Array of data to send (if not already set before) or raw string of data to send, such as JSON.

options (optional)array

Optional options to modify default behavior, see the send() method for details.

Return value

bool string

False on failure or string of contents received on success.

See Also


$http methods and properties

API reference based on ProcessWire core version 3.0.236

Latest news

  • ProcessWire Weekly #514
    In the 514th issue of ProcessWire Weekly we'll check out the latest blog post from Ryan, introduce two new third party modules — Page List Versions Counter and Fieldtype Fieldset Panel — and more. Read on!
    Weekly.pw / 16 March 2024
  • Invoices Site Profile
    The new invoices site profile is a free invoicing application developed in ProcessWire. It enables you to create invoices, record payments to them, email invoices to clients, print invoices, and more. This post covers all the details.
    Blog / 15 March 2024
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani