我正在做一個簡單的cfhttp調用,使用cf10。cfhttp呼叫接管在回調登錄屏幕
我提取的網址是筆直的,我只是將該網址粘貼到地址欄中,它會顯示結果。
相同的鏈接我嘗試在CFHTTP通話,請注意下面的鏈接是假
http://www.fakeurl.net/login2.asp?id=myid&password=mypasswd&t=page.asp&pe=000
現在我CFHTTP電話:
<cfset urlAddress="#trim(link)#">
<cfhttp url="#urladdress#" method="GET" resolveurl="No" throwOnError="Yes"/>
<cfoutput>#CFHTTP.FileContent#</cfoutput>
我帶着阿德里安的意見,這裏是我的下一個嘗試:
<cfset address = "http://www.fakeurl.net/login2.asp">
<cfhttp url="#address#" method="POST" throwOnError="Yes" result="objGet" useragent="#CGI.http_user_agent#">
<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
<cfhttpparam type="url" name="id" value="myid">
<cfhttpparam type="url" name="password" value="mypasswd">
<cfhttpparam type="url" name="t" value="page.asp">
<cfhttpparam type="url" name="rp" value="000">
</cfhttp>
<cfoutput>#objGet.FileContent#</cfoutput>
現在它給我
錯誤
我在你的陳述中沒有找到問題,也沒有真正能夠遵循這些問題。 – 2014-12-02 18:15:36
同上克里斯說的話。很明顯,你的cfhttp調用出了問題,但是不可能說出你描述中的內容。 1)以上代碼的實際結果是什麼?如果您收到錯誤消息,請發佈。 2)你預期會發生什麼? – Leigh 2014-12-02 20:00:08
*現在它給我302錯誤* [HTTP 302](https://en.wikipedia.org/wiki/HTTP_302)意味着重定向。您需要重新閱讀[cfhttp文檔](http://help.adobe.com/zh_CN/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ffc.html)。提示:這是一個屬性;-) – Leigh 2014-12-02 21:13:39