gpt4 book ai didi

coldfusion - 使用 CFHTTP 登录并获取 cookie

转载 作者:行者123 更新时间:2023-12-03 22:39:20 24 4
gpt4 key购买 nike

我想使用 CFHTTP 登录 ( https://pacer.login.uscourts.gov/csologin/login.jsf )。使用 Http Live Header 我们收集了所有必需的参数并发布到登录 url。这是我的示例代码:

<cfhttp url="#arguments.login_url#" method="post" timeout="30" redirect="no" resolveURL="yes" useragent="Mozilla/5.0">
<cfhttpparam name="login" value="login" type="formField">
<cfhttpparam name="login:loginName"value="xxxx"type="formField">
<cfhttpparam name="login:password" value="xxxx" type="formField">
<cfhttpparam name="login:clientCode" value="" type="formField">
<cfhttpparam name="login:Aj_idt206" value="" type="formField">
<cfhttpparam type="formField" name="javax.faces.ViewState" value="stateless">
</cfhttp>

尝试上面的代码后,我们得到了相同的登录页面内容。如何登录上面提到的 Url 并收集了所有 cookie,登录后的 session 。任何人在 CF 中有任何想法或任何线索或任何其他方法?

谢谢

阿图

最佳答案

我想你首先必须做一个 get 请求来开始一个新的 session 然后使用 JSESSIONID 你从get 请求:

<cfhttp url="https://pacer.login.uscourts.gov/csologin/login.jsf" method="get" timeout="30" redirect="no" resolveURL="yes" useragent="Mozilla/5.0">
</cfhttp>

<cfset setcookies = cfhttp['Responseheader']['set-cookie']>

<cfhttp url="https://pacer.login.uscourts.gov/csologin/login.jsf" method="post" timeout="30" redirect="no" resolveURL="yes" useragent="Mozilla/5.0">
<cfhttpparam name="login" value="login" type="formField">
<cfhttpparam name="login:loginName"value="xxxx"type="formField">
<cfhttpparam name="login:password" value="xxxx" type="formField">
<cfhttpparam name="login:clientCode" value="" type="formField">
<cfhttpparam name="login:Aj_idt206" value="" type="formField">
<cfhttpparam type="formField" name="javax.faces.ViewState" value="stateless">
<cfhttpparam type="header" name="Cookie" value="#setcookies#">
</cfhttp>

关于coldfusion - 使用 CFHTTP 登录并获取 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27445052/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com