开发者

Accessing website content in Windows Phone 7

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜