Im am very new to PHP (although i am programmed in object-c programming for iOS and this is why i need this). I need to get the username and password out of a post url and into variables for example this: http://url.com/phpFile.php?username=TheUsernameToGetOut&password=ThePasswordToGetOut Many Thanks
4 Answers
You can find the parameters sent in the url (Get parameters) through the super global array $_GET. example:
$username = $_GET['username'];
$password = $_GET['password'];
If the parameters were sent instead via a post (posting a form) then they will be available through the $_POST super global array. example:
$username = $_POST['username'];
$password = $_POST['password'];
Comments
You should never use a query string to pass such a sensitive information like username and password.
So, there should be just http://example.com/phpFile.php accessed with POST method and thus you will get your variables vis
$username = $_POST['username'];
$password = $_POST['password'];