PHP Curl and Curl
- by mithunmo
Hi ,
I am able to send a get request using PHP Curl .
But the same thing when i try from command line in Linux (/usr/bin/curl )
I am unable to do so.
Please find below my PHP curl that is working
$url = "http://172.20.22.26";
$headers = array("Host: 172.20.22.26",
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-us,en;q=0.5", "Accept-Encoding: gzip,deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 300",
"Connection: keep-alive",
"Authorization: Basic bWl0aHVuOm1pdGh1bg==" );
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'http://172.20.22.26');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
// RETURN THE CONTENTS OF THE CALL
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ch,CURLOPT_AUTOREFERER,TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$store = curl_exec($ch);
?>
But the similar thing when I try to give in command line ( not using php ) it does not work . I get an error "curl: (18) transfer closed with outstanding read data remaining"
and the GET request is not complete
Please find below the command I am using
curl -u mithun:mithun -H "Host: 172.20.22.29,Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,Accept-Language:en-us,en;q=0.5,Accept-Encoding:gzip,deflate,Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7,Keep-Alive: 300,connection: keep-alive,Authorization: Basic bWl0aHVuOm1pdGh1bg==" http://172.20.22.29
The output i get
curl: (18) transfer closed with outstanding read data remaining
<frameset frameborder="0" framespacing="0" border="0" cols="220,*"><frameset frameborder="0" framespacing="0" border="0" rows="68,89%"><frame src="top.htm" name="top" scrolling=no noresize target=top marginwidth=2 marginheight=2><frame src="View.htm" name="left" target=left marginheight=1 scrolling=auto noresize marginwidth=5></frameset><frameset frameborder="0" framespacing="0" border="0" rows="68,*"><frame src="top2.htm" name="top2" target=top2 scrolling=no><frame src="sys_status.htm" name="right" target="_self"></frameset></frameset>[qateam@bras-1-cwmp08 usr]$