Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试通过使用 X-CSRF 令牌进行身份验证的 php/curl 登录网站。查看带有 LiveHttpHeaders 的 Firefox 中的标头,我看不到任何 GET 请求中通过 cookie 传递的令牌……它似乎只出现在 POST 登录请求的标头以及 POST 登录字段中。关于如何通过使用这些令牌的 php/curl 登录网站的任何想法?如何获取令牌并将其与我的用户名和密码一起包含在 post_fields curl_setopt 中?
我在这里发现了我的问题......令牌是通过 html 元标记而不是通过标题或 cookie 传递的。通过 preg_replace 解析 html 以获取令牌就可以了!