HttpUtility
in package
Table of Contents
Constants
- ACCEPTABLE_STATUS_CODES : mixed = [200, 302, 304]
- HEADERS : mixed = ['headers' => ['User-Agent' => 'Mozilla/5.0 (Ma...
- MAX_ATTEMPTS : mixed = 3
- RETRY_DELAY_MICROSECONDS : mixed = 400000
- RETRYABLE_STATUS_CODES : mixed = [403, 429, 500, 502, 503, 504]
- Status codes worth a second try. Some sources (fzla.org) sit behind a bot challenge that 403s the first request on a cold connection, then lets the retry through once its cookie is presented back.
Methods
- guzzleGet() : string
- httpGet() : string
- wordpressGet() : string
Constants
ACCEPTABLE_STATUS_CODES
public
mixed
ACCEPTABLE_STATUS_CODES
= [200, 302, 304]
HEADERS
public
mixed
HEADERS
= ['headers' => ['User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36' . ' (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36', 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 'Accept-Language' => 'en-US,en;q=0.9,es;q=0.8', 'Upgrade-Insecure-Requests' => '1'], 'timeout' => 30]
MAX_ATTEMPTS
public
mixed
MAX_ATTEMPTS
= 3
RETRY_DELAY_MICROSECONDS
public
mixed
RETRY_DELAY_MICROSECONDS
= 400000
RETRYABLE_STATUS_CODES
Status codes worth a second try. Some sources (fzla.org) sit behind a bot challenge that 403s the first request on a cold connection, then lets the retry through once its cookie is presented back.
public
mixed
RETRYABLE_STATUS_CODES
= [403, 429, 500, 502, 503, 504]
Methods
guzzleGet()
public
static guzzleGet(string $url) : string
Parameters
- $url : string
Tags
Return values
stringhttpGet()
public
static httpGet(string $url[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $url : string
- $params : array<string|int, mixed> = []
Return values
stringwordpressGet()
public
static wordpressGet(string $url) : string
Parameters
- $url : string