title: php CURL post large string
body: <p>I need to use php to post a large string (6000 characters) to a server, the string is dynamically created in the php.</p>
  
  <pre><code>$ch = curl_init('http://localhost:8080/mypost');                                                                      
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
      'Content-Type: application/json',                                                                                
      'Content-Length: ' . strlen($data_string))                                                                       
  );     
  $result = curl_exec($ch);
  </code></pre>
  
  <p>It works fine when the data_string is small, but once it gets to be over a few thousand chars it hangs.  No error in php console, just does not finish.  Interestingly, it works fine in Quercus PHP (which does not use libCurl but its own implementation), but it does not work in standard php (PHP 5.3.10-1ubuntu3.26). I need to have it work in standard php. </p>
  
  <p>The accepting server is a JVM-Grizzly server.  I wrote another client in Java and it works fine posting the strings, so I don't think the problem is in the server.</p>
  
  <p>I saw this post (<a href="https://forums.phpfreaks.com/topic/143602-long-string-passed-to-curl-postfields-not-getting-posted/" rel="nofollow noreferrer">https://forums.phpfreaks.com/topic/143602-long-string-passed-to-curl-postfields-not-getting-posted/</a>) which seems promising, but could not get a solution to work.</p>