Are you using php artisan serve and trying to connect to laravel itself?
Dec 26, 2022
25
Level 1
cURL error 28: Operation timed out after 30002 milliseconds
$response = Http::put('http://127.0.0.1:8000/services/update', [
"reference" => $reference,
"status" => "Failed",
]);
Output
cURL error 28: Operation timed out after 30002 milliseconds with 0 bytes received
How to set timeout none?
in python for example i use async with httpx.AsyncClient(timeout=None) as client:
Level 1
@sinnbeck i don't know why but i solved issue by using cURL instead of Guzzle
Before
$reference = explode(",",$request->ids);
$response = Http::put('http://127.0.0.1:8000/services/update', [
"reference" => $reference,
"status" => "Failed",
]);
After
$reference = explode(",",$request->ids);
$curl_post_data = [
"reference" => $reference,
"status" => "Failed",
];
$url ="'http://127.0.0.1:8000/services/update";
$data = json_encode($curl_post_data);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$curl_response = curl_exec($ch);
$result = json_decode($curl_response,true);
also i increase timeout
public function __construct()
{
ini_set('max_execution_time', 1200);
}
1 like
Please or to participate in this conversation.