dpacmittal Posted July 14, 2009 Share Posted July 14, 2009 What if I put incomplete headers in CURL? Would it auto-complete the headers. For eg: $header_array[0] = "POST /dynamic/login.php HTTP/1.1"; $header_array[1]= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 GTB5'; $header_array[2]= "Host: www.mediafire.com"; $header_array[3]= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; $header_array[4]= "Accept-Language: en"; $header_array[5]= "Accept-Encoding: gzip,deflate"; $header_array[6]= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header_array[7]= "Keep-Alive: 300"; $header_array[8] = "Connection: keep-alive"; $header_array[9]= "Cookie: ukey=$ukey;"; $header_array[10]= "Referer: http://www.mediafire.com/"; $header_array[11]= "Content-Type: application/x-www-form-urlencoded"; $url="http://www.example.com/login.php"; $params="login_email=".urlencode("[email protected]")."&login_pass=".urlencode("xxxxxxxxxxx")."&login_remember=on&submit_login=".urlencode("Login to MediaFire"); //$params=urlencode($params); echo $params; $ch= curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HTTPHEADER,$header_array); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE); curl_setopt($ch, CURLOPT_HEADER,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); $abc=curl_exec($ch); Here I haven't set the content-length .. would it set by itself? Link to comment https://forums.phpfreaks.com/topic/165950-incomplete-headers-in-curl/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.