How to post from windows phone 8.1 to PHP Script

0

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);

       }
php
windows-phone-8
asked on Stack Overflow Sep 15, 2015 by Decoder94 • edited Sep 17, 2015 by HaveNoDisplayName

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0