Home>Article>Backend Development> php curl with csrf-token verification simulated submission method
This article mainly introduces the detailed explanation of the simulated submission method of php curl with csrf-token verification. Now I share it with you and give you a reference. Let’s follow the editor and take a look.
Usually for security reasons, a random token value is added to the form to prevent CSRF attacks.
It is actually not difficult to simulate submitting a website with token verification.
1. Obtain the token through regular expressions
2. Bring the obtained token to simulate submission
The following is a successful example
Table of Contents Structure
│ form.php –需要模拟的表单 │ getForm.php – 模拟提交程序 │ post.php –表单验证程序 │ └─cookie – cookie存放目录
getForm.php
getMessage(), "\n"; } unlink($cookie_file); }
form.php
new document
post.php
Related recommendations:
Detailed explanation of using CURL in PHP
The above is the detailed content of php curl with csrf-token verification simulated submission method. For more information, please follow other related articles on the PHP Chinese website!