.net - Reading Content from Web Site -
i want retrieve & store info website . website online shopping web site. want update description , prize per actual link. how can using .net ( think windows application suitable same.)
i tried below code, getting exception
"the remote server returned error: (500) internal server error."url = ds.tables[0].rows[i]["url"].tostring(); var webclient = new webclient();.
sample url http://www.flipkart.com/royal-son-what0355-wayfarer-sunglasses/p/itmeyx9ymutgg7k7?pid=sgleyx9ydyfyazae&otracker=hp_mod_lifestyle_new-arrivals_prd_img
you may want set user-agent on webclient before using load website.
see below. i've used user-agent string chrome 37
var str = "http://www.flipkart.com/royal-son-what0355-wayfarer-sunglasses/p/itmeyx9ymutgg7k7?pid=sgleyx9ydyfyazae&otracker=hp_mod_lifestyle_new-arrivals_prd_img"; var client = new webclient(); client.headers.add("user-agent","mozilla/5.0 (windows nt 6.3; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/37.0.2049.0 safari/537.36"); var ret = client.downloadstring(new uri(str));
if interested in "scraping" specific parts of page you'll want utilize tool htmlagilitypack help that.
.net
No comments:
Post a Comment