OK. Here's one: I have the following code:
PHP Code:
<?php
$content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodCall><methodName>metaWeblog.getCategories</methodName><params><param><value><string>1</string></value></param><param><value><string>{USERNAME}</string></value></param><param><value><string>{PASSWORD}</string></value></param></params></methodCall>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDSIZE, strlen($content));
curl_setopt($ch, CURLOPT_POSTFIELDS,$content);
curl_setopt($ch, CURLOPT_URL,'{URL}');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Don't stress about SSL validity
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$headers[] = "Authorization: BASIC ".base64_encode('{USERNAME}:{PASSWORD}');
$headers[] = 'Content-type: application/xml';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result=curl_exec ($ch);
$curl_error = curl_error($ch);
$curl_error_no = curl_errno($ch);
if ($curl_error_no > 0) {
$curl_error = curl_error($ch);
$curl_error_no = curl_errno($ch);
echo "cURL Error: (".$curl_error_no.") ".$curl_error;
} else {
echo "Successfully retrieved: ".$result;
}
curl_close ($ch);
?>
Which works on most servers just fine to fetch the XML returned by WordPress for a category listing. On one server, though, I get this message:
cURL Error: (18) transfer closed with 1372 bytes remaining to read
I have searched and searched (
curl "transfer closed with" "bytes remaining to read" - Google Search ) and read and read and cannot find a hint as to what the hell is happening. Does anyone have a clue on this? If so, can you clue me in?
Thanks a ton in advance!!!!!
NOTE: You'd need to change {USERNAME}, {PASSWORD}, and {URL} to the appropriate values for testing. Due to confidentiality, I cannot release the URL where this is failing, but I can get server info if necessary.