I am getting this error while post from a Windows Phone 8.1 to a PHP Script
Exception from HRESULT: 0x80072EFD
The post from a console app to the PHP script works fine, but something is different for the Windows Phone.
In the console app I used ASCIIEncoding
but I could not find it in Windows Phone so I am using HttpClient
. I am running Apache on WAMP.
static HttpClient clientOb = new HttpClient();
static Uri uri = new Uri("http://192.168.1.4/sign_in.php");
static Dictionary<string, string> pairs = new Dictionary<string, string>();
public async void webReq()
{
try
{
pairs.Add("email", "1");
pairs.Add("password", "1");
await AsyncTask();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
txtOut.Text = ex.Message;
}
}
static async Task AsyncTask()
{
try
{
HttpFormUrlEncodedContent formContent = new HttpFormUrlEncodedContent(pairs);
HttpResponseMessage response = await clientOb.PostAsync(uri, formContent);
if (response.IsSuccessStatusCode)
{
var dialog = new MessageDialog(response.Content.ToString());
await dialog.ShowAsync();
Debug.WriteLine(dialog);
Debug.WriteLine("dialog");
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
User contributions licensed under CC BY-SA 3.0