如何通过cURL发送大数据?

问题描述:

我正在将数据从一台服务器迁移到另一台服务器,并且正在使用curl进行迁移.到目前为止,我已经取得了成功,但是有些大型实体尚未迁移!

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!

我已经尝试过serialize,但是即使这样也无法正常工作,也不会显示任何错误! php的所有设置都配置为最大.

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;`

 $postdata = http_build_query($postDataFinalArray);

请帮助!

数组大小为400540,COUNT_RECURSIVE.

The array size is 400540, COUNT_RECURSIVE.

您的帖子大小超出了您设置的8MB post_max_size.尝试在php.ini中使用将其增加到大约64MB(或更高,具体取决于发布数据的大小):

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

或在脚本中

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