我是新手,但我认为Paw可以满足我的需求:
我需要在登录页面后面提取会话ID。我进入https://admin.booking.com,填写表单(登录并通过),后面的登录页面包含会话ID:https : //admin.booking.com/pc/index.html?ses = xxxxyyyyyzzzzz11112222233333
我想 :
1)将Paw的凭证作为我的请求的一部分,
2)获取上述项目(ses)作为响应,以便我可以使用Paw提供的php脚本扩展名,然后将该脚本称为“按需”。
这可能吗 ?如果是这样,我该怎么办?
谢谢你的帮助
UPDATE *:我们添加了一个文档文章来描述该过程:通过Paw中的Web表单登录。我们还详细介绍了处理CSRF令牌的过程。
Paw尚未准备好处理Web / HTML表单。不过,有一种正确的方法:如果您使用Chrome开发者工具检查表单,则会name
从DOM / HTML中找到输入内容:
In your case, you have the inputs: loginname
, password
, lang
. Also, find the <form…>
tag to see what's the action
attribute. If there's no action
attribute (like in your example), it means the target URL for your form is the current page's URL (https://admin.booking.com/
in your case). Also, make sure the method="POST"
is also there in the <form…>
tag, otherwise this method won't work.
Then jump into Paw and set:
https://admin.booking.com/
)If all works, you'll see Paw show a redirection request, and if you go to the right-hand side panel under "Response" > "Headers", you should see a Location
header with a value similar to the URL you initially mentioned (https://admin.booking.com/pc/index.html?ses=xxxxyyyyyzzzzz11112222233333
). Hurray! You got your value into Paw!
Now that you have that, you can create in a new request (click on the + button at the bottom of the left-hand side list). And wherever you want to use this session token/ID, you can insert a dynamic value to retrieve that URL value. You have more infos here, in our docs, but I'll describe the steps here:
On whichever field you want to insert the token, right-click and pick Responses > Response Header.
Make sure you pick the first request in the "Request" dropdown menu, and enter Location
in the "Header" field:
You should see the value of the Location
header of the previous response appear here.
Now what you want to do is to extract only the part you want (i.e. the value of the ses
param in your case). For that you'll need that extension for Paw, so please install it now: https://luckymarmot.com/paw/extensions/RegExMatch
Copy the dynamic value you have just inserted (the blue token), and right-click on that field to insert a new dynamic value, and pick Extensions > RegExp match:
在“输入”字段中,粘贴先前复制的动态值。并使用RegExp字段编写一个正则表达式,该表达式将成功提取所需的URL部分(这对您而言适用ses=(.*)
)。
现在,您已经设置好了。您应该可以随时随地使用这个新的蓝色小标记,并自动从以前的表单中提取值。每当您再次发送初始请求并获得新令牌时,其他所有内容也会更新!:)
这是一个很长的指南,但是我希望这对您有帮助,对其他人也有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句