How to send big data on cURL?

I am transferring data from one server to another, and I use curl to do this, so far I have been successful, but there are some large objects that are not migrated! I tried serializing, but even this does not work, the error page does not appear! Php has all the settings configured to maximum,

    $ch = curl_init(); 
  curl_setopt ($ch, CURLOPT_URL, $url); 
  curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
  curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
  curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); 
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt ($ch, CURLOPT_REFERER, $url); 
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
  curl_setopt ($ch, CURLOPT_POST, 1); 
  curl_setopt( $ch, CURLOPT_ENCODING, 'gzip,deflate');
  $result = curl_exec ($ch);
  echo $result;
  curl_close($ch);

I used this with both:

$stringPost = serialize($postDataFinalArray);
  $postdata = 'string='.$stringPost;`

and

 $postdata = http_build_query($postDataFinalArray);

Please, help!

The size of the array is 400540, COUNT_RECURSIVE.

+4
source share
1 answer

The size of your message exceeds your set of post_max_size8 MB. Try increasing this to 64 MB (or higher, depending on the size of the published data) using php.ini:

post_max_size=64M

or in the script:

ini_set('post_max_size', '64M');
+2

Source: https://habr.com/ru/post/1655502/


All Articles