我想在 curl 标头中发送以下数据。
Content-Type: multipart/form-data; boundary=---------------------------28854217951032752725060171
我使用了下面的代码,但它似乎不起作用
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13");
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: multipart/form-data; boundary=---------------------------28854217951032752725060171'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch,CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch,CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
$last = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$info = curl_getinfo($ch);
return array($result,$last,$info);
curl_close($ch);
发送边界值的正确方法是什么。
Ps : 28854217951032752725060171 是常数值。