Few points which may help you to resolve your problem.
1) Remove extra space between
login-action.php
and
?
from your Url.
string url = string.Format("http://control.shaboshabo.com/login-action.php?username={0}&password={1}", "xxx", "yyy");
2) If I type below Url in browser then it showing me message - "
Wrong username or password".
http://control.shaboshabo.com/login-action.php?username=xxx&password=yyy
That means PHP Website does authenticating cridentials passed as a QueryString but those are wrong cridentials. Try by passing valid cridentials.
3) Use
Get
as a Method Type instead of
Post
, as you are passing details in Url(QuesryString) and does not actually posting any Data.
Updated - I tested your code for first Url and it is returning Status as "
OK". Change your condition as below.
if (response.StatusCode != HttpStatusCode.OK)
{
Console.WriteLine("Something Wrong");
response.Close();
request.KeepAlive = false;
return;
}
HttpStatusCode.OK
indicates your HTTP Request was successful and accessible. But that does not necessarily means your PHP site has authenticated those cridentials succeessfully. For that you will have to pass valid cridentials.
Have a look at below link for more information on
HttpStatusCode
.
http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode.aspx