Easy HTTPS to PHP script
Posted
by
Tom
on Stack Overflow
See other posts from Stack Overflow
or by Tom
Published on 2010-12-27T20:49:15Z
Indexed on
2010/12/27
20:54 UTC
Read the original article
Hit count: 166
Hi,
here is my scenario:
I have a website with php, mySQL. I have a software application that has a login screen and sends usernames and passwords over the web by http:
public String GetWebPageSource(String pURL)
{
try
{
byte[] vReceivedBytes = null;
using (System.Net.WebClient vWebClient = new System.Net.WebClient())
{
vReceivedBytes = vWebClient.DownloadData(pURL);
}
int vBomLen = 3;
byte[] vStrippedBytes = new byte[vReceivedBytes.Length - vBomLen];
Array.Copy(vReceivedBytes, vBomLen, vStrippedBytes, 0, vReceivedBytes.Length - vBomLen);
return System.Text.Encoding.UTF8.GetString(vStrippedBytes);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return null;
}
}
So to send a username and password I would write:
GetWebPageSource("http://mywebsite.com/Login.php?username=stackoverflow&password=iscool")
and the php file would spit out some text saying whether the password is accepted or denied.
However this is NOT secure. So I want to make it secure... https. How easy is it to integrate https? How much will the code change? How much do I have to handle? What is transparent to me. Do I have to check if a cookie already exists and if not write the methods for authentication or is there librarys already provided that will do it for me?
© Stack Overflow or respective owner