我試圖用三個參數調用服務:uri,代碼和類型。但有時「type」參數發佈爲空,有時發佈正確。所以服務電話有時會成功,有時會失敗。我不改變任何東西,但參數「類型」有時是空的。我怎麼解決這個問題 ?Php捲曲發佈數據參數有時發送空
$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;
}
你能幫忙嗎?堆棧溢出取決於每個人分享他們的知識。如果你能回答這個問題,請做! – stef