对接万里牛erp 的curl方法
public function curlpost($url,$data){
$headerArray = array("Content-type: application/x-www-form-urlencoded;charset=UTF-8","Accept: application/json","Cache-Control: no-cache", "Pragma: no-cache");
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// echo ‘<pre/>‘;print_r($curl);
$output = curl_exec($curl);
echo ‘<pre/>‘;print_r($output);die;
curl_close($curl);
return json_decode($output,true);
}
//获取毫秒级时间戳
public function getMsecTime() {
list($msec, $sec) = explode(‘ ‘, microtime());
$msectime = (float)sprintf(‘%.0f‘, (floatval($msec) + floatval($sec)) * 1000);
return $msectime;
}