Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# facebook api查询_C#_.net_Facebook_Facebook Graph Api - Fatal编程技术网

C# facebook api查询

C# facebook api查询,c#,.net,facebook,facebook-graph-api,C#,.net,Facebook,Facebook Graph Api,我正在尝试获取我的fb帐户的状态消息,上面的代码抛出了错误的请求,而这个使用facebook api get request的代码表示参数无效 var webRequest = (HttpWebRequest)HttpWebRequest.Create("https://graph.facebook.com/"); webRequest.Method = "POST"; webRequest.ContentType = "application/

我正在尝试获取我的fb帐户的状态消息,上面的代码抛出了错误的请求,而这个使用facebook api get request的代码表示参数无效

 var webRequest = (HttpWebRequest)HttpWebRequest.Create("https://graph.facebook.com/");
            webRequest.Method = "POST";
            webRequest.ContentType = "application/x-www-form-urlencoded";

            var requestString = "fql?q=SELECT status_id, message FROM status 
               WHERE uid=me()";

            byte[] bytedata = Encoding.UTF8.GetBytes(requestString);

            webRequest.ContentLength = bytedata.Length;

            var requestStream = webRequest.GetRequestStream();
            requestStream.Write(bytedata, 0, bytedata.Length);
            requestStream.Close();

            var response = webRequest.GetResponse();
            var responseStream = new StreamReader(response.GetResponseStream());
            var responseString = responseStream.ReadToEnd();
任何帮助都将不胜感激。。脸谱网给了我头晕\ 最后一点是,上面的查询在fql图形api模拟器中工作得非常完美


我想你在找这个:
在“连接”下,您将找到“状态”

为了获得所有状态的数组,必须调用
/me/statuses?access\u token=access\u token
您必须拥有
读取流
权限

希望我能帮忙

编辑: 在WinRT的情况下: 我会用另一种方式调用Graph API(不知道是否更好,但它也能工作):

                string accessToken = ViewState["accessToken"].ToString();
            Facebook.FacebookClient fb = new FacebookClient(accessToken);
            dynamic me = fb.Get("/me");

            var id = me.id;

            string query = "SELECT status_id, message FROM status WHERE uid=me()";

            var posts = fb.Get("/fql?q=SELECT status_id, message FROM status WHERE uid=me()");
// Example Uri
Uri requestUri = new Uri("https://graph.facebook.com/me/statuses?access_token=ACCESS_TOKEN");    

HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(requestUri);

string content = await response.Content.ReadAsStringAsync();
return content;