Namespace: TrishulApi\Core\Http
Implements: TrishulClientInterface
The TrishulClient
class provides methods to make HTTP requests (GET, POST, PUT, DELETE) using cURL. It supports both "mono" and "flux" variants for each HTTP method.
Performs a GET request to the specified URL with provided headers.
$url
(string): The request URL.$headers
(TrishulClientHeader): Headers object.Performs a GET request (flux variant) to the specified URL with provided headers.
$url
(string): The request URL.$headers
(TrishulClientHeader): Headers object.Performs a POST request to the specified URL with provided data and headers.
$url
(string): The request URL.$data
(mixed): Data to send in the request body.$headers
(TrishulClientHeader): Headers object.Performs a POST request (flux variant) to the specified URL with provided data and headers.
$url
(string): The request URL.$data
(array): Data to send in the request body.$headers
(TrishulClientHeader): Headers object.Performs a DELETE request to the specified URL with provided headers.
$url
(string): The request URL.$headers
(TrishulClientHeader): Headers object.Performs a DELETE request (flux variant) to the specified URL with provided headers.
$url
(string): The request URL.$data
(array): Data to send (currently not used in implementation).$headers
(TrishulClientHeader): Headers object.Performs a PUT request to the specified URL with provided data and headers.
$url
(string): The request URL.$data
(mixed): Data to send in the request body.$headers
(TrishulClientHeader): Headers object.Performs a PUT request (flux variant) to the specified URL with provided data and headers.
$url
(string): The request URL.$data
(array): Data to send in the request body.$headers
(TrishulClientHeader): Headers object.
Private helper method to perform the actual cURL request.
Sets up cURL options based on the request type and executes the request.
$url
(string): The request URL.$requestType
(string): HTTP method (GET, POST, PUT, DELETE).$data
(mixed): Data to send in the request body (if applicable).$headers
(array): Array of headers.
$client = new TrishulApi\Core\Http\TrishulClient();
$headers = new TrishulApi\Core\Http\TrishulClientHeader();
$response = $client->get_mono('https://api.example.com/data', $headers);