我正在使用 C# 和 ASP.NET 对此进行编码。我不希望用户被迫登录并授权我的 facebook 应用程序,所以我编写了这段代码来让我的令牌正常工作:
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/oauth/access_token?client_id=MYID&client_secret=MYSECRET&user_id=MYUSERID&grant_type=client_credentials");
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string result1 = sr.ReadToEnd();
sr.Close();
myResponse.Close();
string token = result1.Substring(13, result1.Length - 13);
然后我写了这段代码来获取我最近的帖子:
HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(string.Format("{0}{1}","https://graph.facebook.com/app/posts?access_token=",token));
myRequest1.Method = "GET";
WebResponse myResponse1 = myRequest1.GetResponse();
//StreamReader sr1 = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8);
StreamReader sr1 = new StreamReader(myResponse1.GetResponseStream());
string result2 = sr1.ReadToEnd();
sr1.Close();
myResponse1.Close();
如何快速将此 JSON 对象转换为表格?