douchi5822 2015-09-15 21:46
浏览 22

如何从Windows Phone 8.1发布到PHP脚本

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

       }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
    • ¥15 对于squad数据集的基于bert模型的微调
    • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
    • ¥20 steam下载游戏占用内存
    • ¥15 CST保存项目时失败
    • ¥15 树莓派5怎么用camera module 3啊
    • ¥20 java在应用程序里获取不到扬声器设备
    • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
    • ¥15 Attention is all you need 的代码运行
    • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗