CURL ERROR: Falha de recebimento: Conexão redefinida por peer - PHP Curl

Estou com esse estranho erroCURL ERROR: Falha de recebimento: Conexão redefinida pelo par

É assim que acontece, se eu não conectei ao servidor e, de repente, tentando me conectar ao servidor via CURL em PHP, recebo o erro. Quando eu executo o script CURL novamente o erro desaparece e funciona bem o tempo todo, se eu deixar o servidor remoto ocioso por cerca de 30mins ou reiniciar o servidor remoto e tentar se conectar novamente, obtenho o erro novamente. Assim, parece que a conexão está ociosa e, de repente, o servidor acorda e, em seguida, trabalha e depois dorme novamente.

É assim que meu script CURL parece.

<code>$url = Yii::app()->params['pdfUrl'];
            $body = 'title='.urlencode($title).'&client_url='.Yii::app()->params['pdfClientURL'].'&client_id='.Yii::app()->params['pdfClientID'].'&content='.urlencode(htmlentities($content));

            $c = curl_init ($url);
            $body = array(
                "client_url"=>Yii::app()->params['pdfClientURL'],
                "client_id"=>Yii::app()->params['pdfClientID'],
                "title"=>urlencode($title),
                "content"=>urlencode($content)

            );
            foreach($body as $key=>$value) { $body_str .= $key.'='.$value.'&'; }
                rtrim($body_str,'&');

            curl_setopt ($c, CURLOPT_POST, true);
            curl_setopt ($c, CURLOPT_POSTFIELDS, $body_str);
            curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
            curl_setopt ($c, CURLOPT_CONNECTTIMEOUT , 0);
            curl_setopt ($c, CURLOPT_TIMEOUT  , 20);

            $pdf = curl_exec ($c);
            $errorCode = curl_getinfo($c, CURLINFO_HTTP_CODE);
            $curlInfo = curl_getinfo($c);
            $curlError = curl_error($c);

            curl_close ($c);
</code>

Estou totalmente sem ideias e soluções, por favor me ajude, vou agradecer !!!

Se eu verbalizar a saída para ver o que acontece usando

<code>curl_setopt ($c, CURLOPT_VERBOSE, TRUE);
curl_setopt($c, CURLOPT_STDERR, $fp); 
</code>

Eu recebo o seguinte

<code>* About to connect() to 196.41.139.168 port 80 (#0)
*   Trying 196.x.x.x... * connected
* Connected to 196.x.x.x (196.x.x.x) port 80 (#0)
> POST /serve/?r=pdf/generatePdf HTTP/1.1
Host: 196.x.x.x
Accept: */*
Content-Length: 7115
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

* Recv failure: Connection reset by peer
* Closing connection #0
012 20:23:49 GMT
< Server: Apache/2.2.15 (CentOS)
< X-Powered-By: PHP/5.3.3
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
< 
* Closing connection #0
</code>

Eu adicionei o seguinte toe remover o cabeçalho padrão e ainda sem sorte:

<code>curl_setopt ($c, CURLOPT_HTTPHEADER, array( 'Expect:' ) );

> Accept: */* Content-Length: 8414 Content-Type:
> application/x-www-form-urlencoded
> 
> * Recv failure: Connection reset by peer
> * Closing connection #0 r: Apache/2.2.15 (CentOS) < X-Powered-By: PHP/5.3.3 < Connection: close < Transfer-Encoding: chunked <
> Content-Type: text/html; charset=UTF-8 < 
> * Closing connection #0
</code>

questionAnswers(6)

yourAnswerToTheQuestion