屏幕抓取数据库
我一直在寻找有关 Windows Phone 7 屏幕抓取的帮助,但找不到与我想要的相关的任何帮助。我的应用程序的基础是获取在设备上的输入框中输入的电话号码 ->将其传递到网站的搜索框 ->搜索网站的SQL数据库->将原始结果传回手机并将其显示在表格中。
我已获得网站所有者的许可,可以为此目的使用他的在线数据库。
这可能吗?如果可以,我将如何去做?
提前致谢!
编辑:经过一些额外的研究,我发现通过使用 POST 方法,我可以将所需的数据发送到网站上的搜索框,并且成功找到结果,但我不确定如何将结果显示到应用程序本身?我知道数据已通过 WireShark 中查看的数据包成功发送。再次感谢。
发布代码:
InitializeComponent();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("search_name", "Google"); //Test Search
parameters.Add("submit", "Search");
PostClient proxy = new PostClient(parameters);
proxy.DownloadStringCompleted += (sender, e) =>
{
if (e.Error == null)
{
//Process the result...
data = e.Result;
}
};
proxy.DownloadStringAsync(new Uri("http://www.SITE.com/search.php", UriKind.Absolute));
webBrowser1.Navigate(new Uri(, UriKind.Absolute));`
I've been searching for help with screen scraping for the windows phone 7 but cannot find any help relevant to what i want. The basis of my application is to take a phone number typed in an input box on the device -> pass it to a website's searchbox -> search the website's SQL database -> pass the raw results back to the phone and display them in a table.
I have permission from the website owner to use his online database for this purpose.
Is this possible and, if so, how would I go about doing this?
Thanks in advance!
EDIT: After some extra research I've found that with using the POST method I can send the data needed to the search box on the website and the results are successfully found but I am unsure on how to display the results onto the application itself? I know the data is successfully sent via packets viewed in WireShark. Thanks again.
Code for POST:
InitializeComponent();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("search_name", "Google"); //Test Search
parameters.Add("submit", "Search");
PostClient proxy = new PostClient(parameters);
proxy.DownloadStringCompleted += (sender, e) =>
{
if (e.Error == null)
{
//Process the result...
data = e.Result;
}
};
proxy.DownloadStringAsync(new Uri("http://www.SITE.com/search.php", UriKind.Absolute));
webBrowser1.Navigate(new Uri(, UriKind.Absolute));`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不会使用网站的 UI 和屏幕抓取结果,而是创建一个与网页生成的请求类似或相同的 HTTP 请求(这可能是包含表单数据的 POST 请求)。然后,我会将其发送到 Web 服务器并使用类似 HtmlAgilityPack 的内容来解析响应中所需的数据。
实际上,该网站向您提供了一个使用 HTML 作为消息格式的 HTTP API。直接使用它,而不是使用这些消息的客户端呈现,这最终是为用户交互而不是代码交互而设计的。
Rather than using the website's UI and screen scraping the results, I would create an HTTP request similar to or the same as the request generated by the web page (this will probably be a POST request containing form data). I would then send this to the web server and use something like HtmlAgilityPack to parse the required data from the response.
Effectively, the website presents you with an HTTP API using HTML as the message format. Use this directly, rather than using a client side rendering of these messages, which ultimately is designed for user interaction rather than code interaction.
据我所知,不可能/不允许访问 Windows Phone 上运行的其他应用程序。
因此,除非其他应用程序的发布者连接到您的网站/网络服务,否则这是不可能的。
注意:当 Windows Phone 8 推出时,它与 Windows 8 相同或相似,可能会有可用的合同,允许像这样连接应用程序。 (这只是猜测)
As far as I know it is not possible/allowed to access other applications running on the Windows Phone.
So this is not possible unless the publishers of the other applications connect to your website/webservice.
NB: When Windows Phone 8 come out and it is the same as or similar to Windows 8 there might be contracts available that allow the wiring up of application like this. (This is just guessing)