<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[命令行下的CURL获取HTTP头信息，php,curl获取header信息。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Sun, 12 Jun 2011 07:24:22 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	一：命令行下的CURL获取HTTP头信息：<br/>将jackxiang.com 的头信息获取到header.txt中<br/> -D/--dump-header &lt;file&gt; Write the headers to this file<br/><textarea name="code" class="html" rows="15" cols="100">
curl -D header.txt jackxiang.com
</textarea><br/><br/>二：php,curl获取header信息。<br/><textarea name="code" class="php" rows="15" cols="100">
function get_header($url)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;$ch&nbsp;&nbsp;= curl_init();
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_URL, $url);
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_HEADER, true);
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_NOBODY,true);
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
&nbsp;&nbsp;&nbsp;&nbsp;//curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_AUTOREFERER,true);
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_TIMEOUT,30);
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_HTTPHEADER, array(
&nbsp;&nbsp;&nbsp;&nbsp;&#039;Accept: */*&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;&#039;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;&#039;Connection: Keep-Alive&#039;));
&nbsp;&nbsp;&nbsp;&nbsp;$header = curl_exec($ch);
&nbsp;&nbsp;&nbsp;&nbsp;return $header;
&#125;
</textarea><br/>实践Ok如下：<br/><textarea name="code" class="php" rows="15" cols="100">
$remote = curl_init($url);
curl_setopt($remote, CURLOPT_HEADER, true); //加上这个参数也就能获取到cooke在返回里了。
//$code = curl_getinfo($remote, CURLINFO_HTTP_CODE);
$info = curl_getinfo($remote);
print_r($info);
$timeInfo =&nbsp;&nbsp;&#039;Took &#039; . $info[&#039;total_time&#039;] . &#039; seconds to send a request to &#039; . $info[&#039;url&#039;];
echo $timeInfo.&quot;&lt;hr&gt;&quot;;
</textarea><br/><br/><br/>来自：http://ecode.diandian.com/post/2012-02-29/16128295
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] 命令行下的CURL获取HTTP头信息，php,curl获取header信息。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>