Php curl post数据参数有时发送为空

我尝试使用三个参数调用服务: uri、code和type。但有时"type“参数发送为空,有时发送正确。因此服务调用有时成功,有时失败。我不改变任何东西,除了参数"type“,有时是空的。?如何解决这个问题?

$curl_post_data = array(   
        "uri" => $uri,
        "code" => $code,
        "type" => $type
    );

$post_data = http_build_query($curl_post_data);
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPAUTH, xxx);
curl_setopt($curl, CURLOPT_USERPWD, xxx);
curl_setopt($curl, CURLOPT_PROXY, 'xxx');
curl_setopt($curl, CURLOPT_PROXYUSERPWD, 'xxxx');
curl_setopt($curl, CURLOPT_PROXYPORT, xxx);
curl_setopt($curl, CURLOPT_PROXYAUTH, xxx);
$curl_response = curl_exec($curl);
if (false === $curl_response) {
     return null;
}

转载请注明出处:http://www.guonuovip.com/article/20230331/1462934.html