-2

我需要通过位于 localhost 中的 php 文件传递​​一些值。我需要通过 windows mobile 6 应用程序打开该 url。请建议我一个简单的方法来做到这一点。网址类似于:

http://localhost/wlchr/index.php?data=Pharmacy&num=1

问候。

附言

我试过连接管理器,但它给出了错误;“当前上下文中不存在名称‘ConnMgrMapURL’”

4

2 回答 2

0

首先,为了能够回答 localhost 请求,您必须实现一个 Web 服务器。

其次,您的 Web 服务器必须实现 URL 解析以拆分 URL 和参数。

这是一个示例http://www.hjgode.de/wp/2012/10/19/windows-mobile-a-simple-web-server-with-extended-features/但您并没有真正描述您的意图能够使用

http://localhost/wlchr/index.php?data=Pharmacy&num=1

我不知道上述文章是否符合您的需求。

第三:ConnMgrMapURL 不是任何标准 Compact Framework 运行时的一部分。在http://msdn.microsoft.com/en-us/library/bb840031.aspx上的 MSDN 中描述了用于 C# 的本机 ConnMgr API 的实现

进一步阅读 ConnMgr http://www.codeproject.com/Articles/98020/Using-the-Connection-Manager

于 2013-07-01T04:29:56.390 回答
0

我已经通过使用 HttpWebRequest 方法解决了我的问题。

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;

namespace wlchrUrl
{
    class urlConn
    {
        public void DoConnect(string url)
        {
           Uri uri = new Uri(url);
        try
        {
            HttpWebRequest httpRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
            HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
            Stream stream= httpResponse.GetResponseStream();

            httpResponse.Close();
            stream.Close();

        }
        catch(Exception ex)
        {
            throw ex;
        }

    }
}

}

于 2013-07-01T14:33:53.027 回答