php curl post带header 信息

$header[]= 'Host: www.91xiaozao.com';  
  $header[]= 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0';  
  $header[]= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';  
  $header[]= 'Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3';  
  $header[]= 'Referer: http://www.91xiaozao.com/index.php';  
  $header[]= 'Cookie: PHPSESSID=9vor6b3ltjkiu5o45in99cvmg5; TP_userid=czoxOiIxIjs%3D; TP_username=czo0OiJ0ZXN0Ijs%3D';  
  $header[]= 'Connection: keep-alive';  
  
  
  $url='http://www.91xiaozao.com/index.php/home/index';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL,$url);
     $fields = array('lname'=>'justcoding'); 
  curl_setopt($ch, CURLOPT_POSTFIELDS,$fields); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch,CURLOPT_HTTPHEADER,$header);  
  echo $result = curl_exec($ch);

相关推荐