another one curls the dust
Array
(
[curler_info] => Loads the content of a JSON file and executes some callback functions in a row (7 to be specific)
[curler] => Array
(
[url] => https://raw.githubusercontent.com/eypsilon/Curler/master/www.example.json
[http_code] => 200
[status] => ok
[method] => GET
[content_type] => text/plain; charset=utf-8
[meta] => Array
(
[duration] => 0.023154020309448
[size] => 783 B
[timestamp] => 2026-07-30 14:24:07.589900
[url] => https://raw.githubusercontent.com/eypsilon/Curler/master/www.example.json
[method] => GET
)
[error] =>
[response] => {
"Many": "App",
"example": "json file",
"custom_callback": [
"custom_callback done, 14:24:07.589700"
],
"callback_two": [
"callback_two done, 14:24:07.589800"
],
"callback_three": [
"callback_three done, 14:24:07.589800"
],
"callback_class_run": [
"callback_class_run done, 14:24:07.589800"
],
"callback_class_init": [
"callback_class_init done, 14:24:07.589800"
],
"closure_callback": [
"closure_callback done, 14:24:07.589800"
],
"done_too": [
"done_too done, 14:24:07.589900"
]
}
)
[load_urls_info] => Loads a handful of URLs and truncates the response
[load_urls] => Array
(
[0] => Array
(
[url] => http://example.com/
[status] => 200
[response] => <!doctype html>… 2026-07-30 14:24:07.610400
)
[1] => Array
(
[url] => https://raw.githubusercontent.com/eypsilon/browser-reload/master/LICENSE
[status] => 200
[response] => The MIT License (MIT… 2026-07-30 14:24:07.640800
)
[2] => Array
(
[url] => https://github.com/eypsilon/MycroBench
[status] => 200
[response] => <!DOCTYPE html>… 2026-07-30 14:24:07.680900
)
)
[loaded_images_info] => The images displayed above, the responses are truncated
[loaded_images] => Array
(
[0] => Array
(
[response] => data:image/jpeg;base64,/9j/2wBDAAQD …
[http_code] => 200
[type] => image/jpeg
[meta] => Array
(
[duration] => 0.035847902297974
[size] => 12.83 KB
[timestamp] => 2026-07-30 14:24:07.719500
[url] => https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Andaman.jpg/250px-Andaman.jpg
[method] => GET
)
)
[1] => Array
(
[response] => data:image/jpeg;base64,/9j/4QCGRXhp …
[http_code] => 200
[type] => image/jpeg
[meta] => Array
(
[duration] => 0.038769960403442
[size] => 10.75 KB
[timestamp] => 2026-07-30 14:24:07.760900
[url] => https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Aurora_and_sunset.jpg/250px-Aurora_and_sunset.jpg
[method] => GET
)
)
)
[getCurlCount] => 6
[getCurlTrace] => Array
(
[0] => [GET] 200 https://raw.githubusercontent.com/eypsilon/Curler/master/www.example.json (0.0232)
[1] => [GET] 200 http://example.com/ (0.0138)
[2] => [GET] 200 https://raw.githubusercontent.com/eypsilon/browser-reload/master/LICENSE (0.0302)
[3] => [GET] 200 https://github.com/eypsilon/MycroBench (0.0345)
[4] => [GET] 200 https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Andaman.jpg/250px-Andaman.jpg (0.0358)
[5] => [GET] 200 https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Aurora_and_sunset.jpg/250px-Aurora_and_sunset.jpg (0.0388)
)
[getConfig] => Array
(
[default_url] => https://upload.wikimedia.org/wikipedia/commons/thumb
[default_headers] => Array
(
[x-app-curler] => Many/Curler
[Content-Type] => application/json
)
[default_options] => Array
(
[10018] => AwesomeUser
[10102] => gzip, deflate
)
[enable_exceptions] => 1
[enable_meta] => 1
[enable_history] => 1
[date_format] => Y-m-d H:i:s.u
[image_to_data] => Array
(
[0] => image/jpeg
)
[retry_attempts] => 0
[retry_delay_ms] => 100
[retry_on_status] => Array
(
[0] => 429
[1] => 500
[2] => 502
[3] => 503
[4] => 504
)
)
[getOptions] => Array
(
[84] => 4
[10002] =>
[10036] => GET
[42] =>
[10023] => Array
(
[0] => x-app-curler: Many/Curler
[1] => Content-Type: application/json
)
[2] =>
[47] =>
[10015] =>
[81] => 2
[64] => 1
[19913] => 1
[41] =>
[58] => 1
[52] => 1
[68] => 10
[78] => 30
[13] => 60
[10102] => gzip, deflate
[10018] => AwesomeUser
)
)
<?php
/**
* Example Receiver / Responder
*/
/**
* Curler Responder, let's say 'https://example.com/restricted/' is .htaccess protected and returns
*/
use Many\Http\Curler;
$rspns = [
'auth_type' => $_SERVER['AUTH_TYPE'] ?? 'error',
'header' => getallheaders(),
'body' => file_get_contents('php://input'),
'c_types' => [
'json' => 'application/json',
]
];
$setType = $rspns['c_types'][$_GET['c_type'] ?? null] ?? null;
$cType = $setType ?? $_SERVER['CONTENT_TYPE'] ?? 'text/html';
/** Set Content-Type header auto, if requested one is listed in 'c_types' */
if ($setType)
header(sprintf('Content-Type: %s; charset: %s', $cType, $_GET['charset'] ?? 'UTF-8'));
/** Parse received body content */
if (ctype_print($rspns['body']))
parse_str($rspns['body'], $rspns['body_parsed']);
exit('application/json' == $cType
? json_encode($rspns, JSON_PRETTY_PRINT)
: print_r($rspns, true)
);
/**
* Curler Receiver, access the .htaccess protected ressources
*/
$curler = (new Curler)
->authAny('many', '123456') // auto ->authBasic() or ->authDigest()
->postFields([
'lorem_ipsum' => 'Dolor Sit Amet',
])
->jsonDecode()
->exec('https://example.com/restricted/'); // ?c_type=json &charset=UTF-8
printf('<pre>%s<hr /><b>body</b><br />%s</pre>'
, print_r($curler, true)
, $curler['response']->body ?? 'body is not an object'
);
start: 14:24:07.566300 end: 14:24:07.763700 diff: 0.1974 mem: 432.75 KB peak: 1.59 MB