HttpClient
class HttpClient (View source)
Methods
__construct(string|null $base_url = null)
HttpClient Constructor.
void
setBaseUrl(string $url)
Set the base url
addAttach(string|array $attach)
Attach file(s) to the request
setUserAgent(string $user_agent)
Set the User-Agent header
acceptJson()
Configure client to accept and send JSON data
addHeaders(array $headers)
Add custom HTTP headers
Details
__construct(string|null $base_url = null)
HttpClient Constructor.
void
setBaseUrl(string $url)
Set the base url
Response
get(string $url, array $data = [])
Make GET request
Response
post(string $url, array $data = [])
Make POST request
Response
put(string $url, array $data = [])
Make PUT request
Response
delete(string $url, array $data = [])
Make DELETE request
HttpClient
addAttach(string|array $attach)
Attach file(s) to the request
HttpClient
setUserAgent(string $user_agent)
Set the User-Agent header
HttpClient
acceptJson()
Configure client to accept and send JSON data
HttpClient
addHeaders(array $headers)
Add custom HTTP headers