The API documentation clearly states that the wp.newPost returns the new post id, but roughly 40% of the time we're getting a response of false, but with and HTTP Response Code of 100. The post is published to Wordpress successfully either way.
$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;
I'm happy to post a sample $request string, but that part seems to be working fine. I was just wondering if anyone has run into this before? It seems to have been run into here, but with little resolution.
Sheesh. Timeout. Duh. Someone had set the CURL timeout to 1. Nonetheless, we're still not receiving full responses sometimes even without a timeout set - likely the default socket timeout is kicking in. Nonetheless, we have a (somewhat weighty) workaround.
Have a nice day.