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 =
is there anyone in this situation?