How can I send large data over cURL?

南笙酒味 提交于 2019-12-23 10:41:27

问题


I am migrating data from one server to another and I am using curl to do so. I have been successful so far, but there are some large entities that are not migrating!

I have tried serialize but even that is not working, no error is shown! The php has all 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 array size is 400540, COUNT_RECURSIVE.


回答1:


Your post size is exceeding your set post_max_size of 8MB. Try increasing this to something like 64MB (or higher, depending on the size of the posted data) using in php.ini:

post_max_size=64M

or in a script:

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


来源:https://stackoverflow.com/questions/39644377/how-can-i-send-large-data-over-curl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!