athlon1600/php-curl-client
Lightweight, extensible PHP cURL client (PHP 7.3–8.4). Make GET/POST or fully customized requests and always receive a standardized Response with status, body, error, and typed cURL info for IDE autocomplete.
BrowserClient class:
public function setCurlOption($option, $value): voidpublic function setUserAgent($user_agent): voidFull Changelog: https://github.com/Athlon1600/php-curl-client/compare/v1.2.0...v1.3.0
setStorageDirectory($path) method.httpbin.org/redirect-to endpoint is broken: https://github.com/postmanlabs/httpbin/issues/617. That broke some of our test cases. Workarounds had to be added.request method weren't properly overriding default options. + operator does not work the same way as array_merge specifically regarding order:If an array key exists in both arrays, then the element from the first array will be used and the matching key's element from the second array will be ignored.
https://www.php.net/manual/en/function.array-merge.php
Therefore default_options + custom_options had to be changed to: custom_options + default_options
https://curl.haxx.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html
When following a Location:, the 3xx response code that redirected it also dictates which request method it will use in the subsequent request: For 301, 302 and 303 responses libcurl will switch method from POST to GET unless CURLOPT_POSTREDIR instructs libcurl otherwise. All other 3xx codes will make libcurl send the same method again.
the switch does not happen if CURLOPT_CUSTOMREQUEST option is set. Thanks to:
https://github.com/Kong/insomnia/issues/227
How can I help you explore Laravel packages today?