Documentation

WebFetchApiInterface
in

Table of Contents

Methods

request()  : object
Main calling function.
result()  : mixed
Used to return the results to the caller.
resultRaw()  : array<string|int, mixed>
Will return all results from all loops (redirects)

Methods

request()

Main calling function.

public request(string $url[, array<string|int, mixed>|string $post_data = [] ]) : object
  • Will request the page data from a given $url.
  • Optionally will post data to the page form if $post_data is supplied. Passed arrays will be converted to a POST string joined with &'s.
Parameters
$url : string

the site we are going to fetch

$post_data : array<string|int, mixed>|string = []

any post data as form name => value

Return values
object

A reference to the object for method chaining.

result()

Used to return the results to the caller.

public result([string $area = null ]) : mixed
  • called as ->result() will return the full final array.
  • called as ->result('body') to return the page source of the result.
Parameters
$area : string = null

Used to return an area such as body, header, error.

Return values
mixed

The response.

resultRaw()

Will return all results from all loops (redirects)

public resultRaw([int $response_number = null ]) : array<string|int, mixed>
  • Can be called as ->result_raw(x) where x is a specific loop's result.
  • Call as ->result_raw() for everything.
Parameters
$response_number : int = null

Which response to get, or null for all.

Return values
array<string|int, mixed>

The specified response or all the responses.


        
On this page

Search results