php curl post请求中携带header参数

curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); 

或者

  $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,"; 
  $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; 
  $header[] = "Cache-Control: max-age=0"; 
  $header[] = "Connection: keep-alive"; 
  $header[] = "Keep-Alive: 300"; 
  $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; 
  $header[] = "Accept-Language: en-us,en;q=0.5"; 
  $header[] = "Pragma: "; // browsers keep this blank. 
  curl_setopt($curl, CURLOPT_HTTPHEADER, $header); 

全文:http://www.oschina.net/question/180224_115606

posted @ 2016-11-19 13:33  stma  阅读(22704)  评论(0编辑  收藏  举报