CURL速度慢可能与Expect:100-Continue有关,可以修改下代码试验一下:
- 1. 发送一个请求, 包含一个Expect:100-continue, 询问Server使用愿意接受数据
- 2. 接收到Server返回的100-continue应答以后, 才把数据POST给Server
function SendPic($photoVip){
//post数据
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.test.com/savecurl.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
//post最大数据为1024,如果大于就要加下面这句话不然会报错"Expect: 100-continue"
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $photoVip);
$res=curl_exec($ch);
curl_close($ch);
//exit;
}