mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-14 20:36:37 +00:00
Update ::afterSend() examples
This commit is contained in:
@@ -24,7 +24,7 @@ $curl->success(function ($instance) {
|
||||
'after ' . $instance->attempts . ' attempt(s).' . "\n";
|
||||
});
|
||||
|
||||
$curl->setError(function ($instance) {
|
||||
$curl->afterSend(function ($instance) {
|
||||
$random_number = (int)$instance->response->args->number;
|
||||
$lucky = $random_number === 7;
|
||||
$instance->error = !$lucky;
|
||||
@@ -36,7 +36,7 @@ $curl->setError(function ($instance) {
|
||||
|
||||
$curl->get('https://httpbin.org/get?number=' . random_int(0, 10));
|
||||
|
||||
// $ php curl_set_error.php
|
||||
// $ php curl_after_send.php
|
||||
// about to make request to https://httpbin.org/get?number=3
|
||||
// about to make request to https://httpbin.org/get?number=1
|
||||
// about to make request to https://httpbin.org/get?number=7
|
||||
@@ -24,7 +24,7 @@ $multi_curl->success(function ($instance) {
|
||||
'after ' . $instance->attempts . ' attempt(s).' . "\n";
|
||||
});
|
||||
|
||||
$multi_curl->setError(function ($instance) {
|
||||
$multi_curl->afterSend(function ($instance) {
|
||||
$random_number = (int)$instance->response->args->number;
|
||||
$lucky = $random_number === 7;
|
||||
$instance->error = !$lucky;
|
||||
@@ -37,7 +37,7 @@ $multi_curl->setError(function ($instance) {
|
||||
$multi_curl->addGet('https://httpbin.org/get?number=' . random_int(0, 10));
|
||||
$multi_curl->start();
|
||||
|
||||
// $ php multi_curl_set_error.php
|
||||
// $ php multi_curl_after_send.php
|
||||
// about to make request to https://httpbin.org/get?number=4
|
||||
// about to make request to https://httpbin.org/get?number=7
|
||||
// success!
|
||||
Reference in New Issue
Block a user