Files
php-curl-class/examples/get.php
T
Zach Borboa acf8e9f6a0 Include curl error code constant in curl error message (Curl::curlErrorMessage)
Before:
    Timeout was reached: Operation timed out after 30001 milliseconds with 1453867 out of 3000000 bytes received

After:
    Timeout was reached (CURLE_OPERATION_TIMEOUTED): Operation timed out after 30001 milliseconds with 1453867 out of 3000000 bytes received
2022-09-30 07:52:27 -07:00

19 lines
354 B
PHP

<?php
require __DIR__ . '/../vendor/autoload.php';
use Curl\Curl;
// curl --request GET "https://httpbin.org/get?key=value"
$curl = new Curl();
$curl->get('https://httpbin.org/get', [
'key' => 'value',
]);
if ($curl->error) {
echo 'Error: ' . $curl->errorMessage . "\n";
} else {
echo 'Response:' . "\n";
var_dump($curl->response);
}