I am trying to retrieve different strings which are stored in php files, such as http://www.site_address.com/file.php. I have tried many curl commands, such as
curl -d "user=__&password=____" http://www.site_address.com/file.php
but all it doesn't really seem to work: it just returns a form action. This is how a file.php looks like:
<?php
$message="string";
if(isset($_POST['login']))
{
if ($_POST['username'] != '' && $_POST['password'] !='') {
if ($_POST['username'] == 'user' && $_POST['password'] == 'pass') {
echo $message;
exit();
}
else {
$error = 'failed!';
}
}
else {
$error = 'Error!';
}
}
if (isset($error))
{
echo $error;
}
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Username: <input type="text" id="username" name="username" size="32" value="" /><br />
Password: <input type="password" id="password" name="password" size="32" value="" /><br />
<input type="submit" name="login" value="Login" />
</form>
I have to add that I have no knowledge regarding PHP. In this case, I am simply the client. Do I have to use other flags for the curl command in order to get that string from "$message"?