I have 2 files below, and I'm trying to use cURL to automatically log in and get the message "login success", as oppose to the message "login fail". How would I do that?
I know this may look like I'm begging for others to write my codes for me, and that I didn't put any effort into researching cURL, and making my own cURL code, before asking this question. But, I've actually done a lot of researching, but I wasn't able to find any examples that I understanded, or does what I wanted it to do, so that's why I'm asking here. Please help if you can.
test1.php
<form method = "POST" action = "test2.php">
<input type = "username" name = "username">
<input type = "password" name = "password">
<input type = "submit" value = "submit">
</form>
test2.php
$username = $_POST['username'];
$password = $_POST['password'];
if ($username == "username" && $password == "password") {
echo "login success";
}
else {
echo "login fail";
}
Need Result:
login success