$cookies_str = '';
for ($i=0; $i < 1000; $i++) {
$cookies_str .= "test{$i}=testtestestestsetse{$i}; ";
}
$param = [
//set params here
];
$param = http_build_query($param);
///
$url = "http://localhost/get_test.php";
$cUrl = curl_init($url);
curl_setopt($cUrl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($cUrl, CURLOPT_POSTFIELDS, $param);
curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cUrl, CURLOPT_TIMEOUT, 5);
curl_setopt($cUrl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($cUrl, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'Content-Length: ' . strlen($param)
]);
curl_setopt($cUrl, CURLOPT_COOKIE, $cookies_str);
//execute post
$data = curl_exec($cUrl);
//close connection
curl_close($cUrl);
When I set $i
=10, curl_exec will do sync. But when I set $i
=1000, curl_exec will do async (not sync).
How to force curl_exec always do sync ?
Please help ! Thank you for advanced.