【发布时间】:2018-05-29 22:15:20
【问题描述】:
如何获取 curl 响应中隐藏输入的值
<input type="hidden" name="csrf_token" value="b93779b0fd991381de4b67d60a2c4cd948ad1dc9" />
我试过了
$rets = curl_exec($ch);
if (preg_match("/csrf_token/", $rets, $spoof)){
print_r($spoof);
// here it found it but can't get the value
}
我试过这个
if(preg_match("/name=\"csrf_token\" value='([a-zA-z0-9]{32})'/", $rets, $spoof))
//empty respown
{
那么,我该怎么做才能解决这个问题?
【问题讨论】:
-
为什么需要使用 curl 来获取 csrf 令牌?闻起来有点腥
标签: php regex preg-match