;中国 COLD FUSION 用户组; WWW.CFWINDOW.COM 
您的位置 :首页 >> CF 技巧文章 >> 阅读文章内容 [ 关闭窗口 ]      

技巧文章内容 
    Cfhttp用发一例
文章作者 : linkfoxo [ webmaster@cfwindow.com ]          Web URL : http://www.cfwindow.com
上载日期 : 2000-12-20

Cfhttp用发一例

以下代码演示如何从网络上取的网页的内容, 以及如何获取以下信息:

  获得网页的MIME类型
  获得: header responses (responseHeader)

<CFHTTP
    URL = "http://www.cftipsplus.com"
    resolveurl = 1
    throwonerror = Yes
>
</CFHTTP>

<CFOUTPUT>
#cfhttp.filecontent#<BR>
<BR>
<H3><B>The mime-type:</B></H3><BR>
#cfhttp.mimetype#<BR>
<H3><B>The Status Code:</B></H3><BR>
#cfhttp.statuscode#<BR>
<H3><B>The Raw Header:</B></H3><BR>
#cfhttp.header#<BR>

</CFOUTPUT>

<H3><B>Output the Response Headers:</B></H3><BR>
<HR>

<CFLOOP collection=#CFHTTP.RESPONSEHEADER# item="httpHeader">
    <CFSET value = CFHTTP.RESPONSEHEADER[httpHeader]>
    <CFIF IsSimpleValue(value)>
        <CFOUTPUT>
            #httpHeader# : #value#<BR>
        </CFOUTPUT>
    <CFELSE>
        <CFLOOP index="counter" from=1 to=#ArrayLen(value)#>
            <CFOUTPUT>
                #httpHeader# : #value[counter]#<BR>
            </CFOUTPUT>
        </CFLOOP>
    </CFIF>
</CFLOOP>







< 联系我们 --- 中国Cold Fusion用户组>

CFUG 国内(总部):Linkfoxo    上海:CFANS    北京:Cafe,Cyberkid,liwater    沈阳:Wangking
  
哈尔滨:Baiming    浙江:梅盛松    江西:陈末
  
CFUG (国际) Nagoya(名古屋):Codeguru    新加坡:YUZI    新西兰(Auckland):Richard CHEN
Copyright 2000-2001 www.cfwindow.com.All rights reserved

;中国 COLD FUSION 用户组; WWW.CFWINDOW.COM