Php wordpressapi-XML-RPC:wp.newPost大约40%的时间返回false

Php wordpressapi-XML-RPC:wp.newPost大约40%的时间返回false,php,wordpress,curl,xml-rpc,Php,Wordpress,Curl,Xml Rpc,很明显,wp.newPost返回新的post id,但是大约有40%的时间我们得到的响应是false,但是HTTP响应代码是100。无论哪种方式,帖子都会成功发布到Wordpress $ch = curl_init(); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_URL, $this->getXMLRPCURL()); curl_setopt($ch, CURLOPT_RETURNTRA

很明显,wp.newPost返回新的post id,但是大约有40%的时间我们得到的响应是false,但是HTTP响应代码是100。无论哪种方式,帖子都会成功发布到Wordpress

$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $this->getXMLRPCURL());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);

// Encode htaccess credentials if they're set
$htaccess_credentials = $this->getHtaccessCredentials();
if ($htaccess_credentials) {
  curl_setopt($ch, CURLOPT_USERPWD, $htaccess_credentials->toString());
}

$results = curl_exec($ch); // <<-- RETURNS FALSE HERE.
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Returns 100
curl_close($ch);
return $results;
$ch=curl_init();
curl_setopt($ch,CURLOPT_POSTFIELDS,$request);
curl_setopt($ch,CURLOPT_URL,$this->getXMLRPCURL());
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_超时,1);
//对htaccess凭据进行编码(如果已设置)
$htaccess_credentials=$this->getHtaccessCredentials();
if($htaccess\u凭证){
curl_setopt($ch,CURLOPT_USERPWD,$htaccess_credentials->toString());
}

$results=curl_exec($ch);// 嘘。超时。嗯。有人已将卷曲超时设置为1。尽管如此,我们仍然没有收到完整的响应,有时甚至没有设置超时-很可能默认的套接字超时正在启动。尽管如此,我们还是有一个(相当重要的)解决办法

祝你今天愉快