开发者

Accessing website content in Windows Phone 7

开发者 https://www.devze.com 2023-01-22 19:55 出处:网络
I\'m looking for how to a开发者_如何学Cccess information on a website from a Windows Phone 7 device, without opening a brower window.For example, if I had a website that provided a daily dictionary wo

I'm looking for how to a开发者_如何学Cccess information on a website from a Windows Phone 7 device, without opening a brower window. For example, if I had a website that provided a daily dictionary word and definition, how could I navigate to that word in my wp7 app without opening the whole page for display?

In a sense the app would be a page scraper, just looking for some of the data on a page.

I know how to open a web browser programmatically, but haven't been able to find out how to get a page's content without a browser window.


You can pull http data down using WebClient (if trivial volume) or HttpWebRequest (better for UI thread responsiveness).

API's here for your reference.

HttpWebRequest Class (System.Net)

WebClient Class (System.Net)

A demo project showing both in use here.

WebClient, HttpWebRequest and the UI Thread on Windows Phone 7

You'll then need to parse the html you pull down to get out of it what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消