i am writing web-services for login script. Which i have to keep on HTTPS server. in general we are getting username & password on server side as
if(isset($_REQUEST['login'])){
$user=mysql_escape_string($_REQUEST['username']);
$password=hash('sha512',$_REQUEST['password']);
}
But this is fine for HTTP connection.
I have never used HTTPS connection for web services, So i want to know Is there some other way to pass username & password over HTTPS connection? So how to retrieve data from that request.
My client wants to send these data in header information some thing like
Method: POST
Content-Type: application/x-www-form-urlencoded
Content: username=mynames&password=abcabc
And from here i need to retrieve data.i have no idea about this.
HTTPS is effectively transparent to PHP code. It’s entirely handled by the browser and the server. You can access the $_REQUEST variables exactly the same as with an HTTP request.
Edit (slightly modified question):
If your client wants you to have a login form to submit the username and password (as your changes to the question indicate), you just make form inputs the same as you would normally in an HTTP connection. Name them “username” and “password”, respectively, and then pull their data from $_POST on the page you’re posting the form to. Setting up the server to respond on HTTPS will make it handle everything else transparently, as I mentioned previously.