I am having some issues with cURL. It's not really cURL, but it's checking if the gotten message from the curl request is correct to a form. Here is what I have:
As you can see, on the submit case, it gets the username and password from the post and then creates the URL with $database. Then it sets it to the full URL, and basically prints it out. I want to then take that print (echo) and check if it matches EXACTLY to the form. As you can see, I have the if(curl_exec) but that does not work. I have also tried putting a variable over the cURL, but that didn't work.
If anybody has any idea that would be great!
Kind regards.
| Code: |
| <?php
//include("config.php"); switch($_GET['page']) { default: ?> <form action="?page=submit" method="post"> Username: <input type="text" name="username"> Password: <input type="text" name="password"> <input type="submit" value="Login!"> </form> <?php break; case 'submit': // define the variables $username = $_POST['username']; $password = $_POST['password']; $database = "http://can't-give-out-ip/users/$username"; $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,"$database/pass.txt"); curl_exec($curl_handle); curl_close($curl_handle); if(curl_exec == $password) { echo "<BR>Hello!"; } else { echo "<BR>Too bad!"; } } ?> |
As you can see, on the submit case, it gets the username and password from the post and then creates the URL with $database. Then it sets it to the full URL, and basically prints it out. I want to then take that print (echo) and check if it matches EXACTLY to the form. As you can see, I have the if(curl_exec) but that does not work. I have also tried putting a variable over the cURL, but that didn't work.
If anybody has any idea that would be great!
Kind regards.
