我的網址是 http://www.whatsonindia.com/appi/user?channelgenre=all&context=applicationname%3Dsourcebits%3Bheadendid%3D0&dateselected=0&mode=getTVGuideInfo&pageno=1&responseformat=json&responselanguage=English&starthour=0&totalhrdata=24&userid=-1如何使用C#訪問網頁內容
我試試這個
1.
string [email protected]"http://www.whatsonindia.com/appi/user";
WebClient client = new WebClient();
NameValueCollection myQueryStringCollection = new NameValueCollection();
myQueryStringCollection.Add("channelgenre", "all");
myQueryStringCollection.Add("context", "applicationname%3Dsourcebits%3Bheadendid%3D0");
myQueryStringCollection.Add("dateselected", "0");
myQueryStringCollection.Add("mode", "getTVGuideInfo");
myQueryStringCollection.Add("pageno", "1");
myQueryStringCollection.Add("responseformat", "json");
myQueryStringCollection.Add("responselanguage", "English");
myQueryStringCollection.Add("starthour", "0");
myQueryStringCollection.Add("totalhrdata", "24");
myQueryStringCollection.Add("userid", "-1");
client.QueryString = myQueryStringCollection;
var json = client.DownloadString(url);
2.
string url="http://www.whatsonindia.com/appi/user?channelgenre=all&context=applicationname%3Dsourcebits%3Bheadendid%3D0&dateselected=0&mode=getTVGuideInfo&pageno=1&responseformat=json&responselanguage=English&starthour=0&totalhrdata=24&userid=-1";
WebClient client = new WebClient();
var data=client.DownloadString(url);
既給錯誤:(500)internel服務器錯誤,我解決它?任何人都可以幫我
你能告訴頁面如何設置cookie。請爲此提供代碼 – user3345208