The interface on which the php curl post request executes one curl_exce request is executed twice.

1, php curl post request interface, print log curl_exce, is executed once, but the requested interface is repeated twice.
2, code:
$ch = curl_init ();

if(false === $ch){
    writeRedisLog("create_curl", $activity_id, $mobile, $user_id, "", 0, "curl failed to initialize");
}
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
writeLog($activity_id, $mobile, $user_id."_H");
$res = curl_exec($ch);
$return_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error_no = curl_errno($ch);
$error_str = curl_error($ch);
curl_close($ch);
//if(!$res){
    writeRedisLog("error_request", $activity_id, $mobile, $user_id, $res, $error_no, $error_str);
//}
//
$res = json_decode($res, true);

Log of curl operation request API:
_ Hang 15515420703 / 2018-06-25 1653 href= 25 = clipboard.png

is there anyone in this situation?

Mar.21,2021

in this case, my previous problem was that the path to load the image resource was miswritten, resulting in two requests for each click

solution to this situation: check the nginx or apache log to see what request was made, or look at firebug


problem resolved ~ ~ reason the PHP process timed out, the load balancer server did not receive the return result, and then made another request.

Menu