Sunday, July 13, 2014

Post (Fake) Position Via Facebook

After the previous two preparing posts I today want to show, how one can post his position via Facebook, but use any arbitrary place as this.
We use the code of the post publish Facebook posts, and append the data submitted there with the parameter place. With this we can specify our (alleged) position, so that then "in X" is written below the post.
As place we can either, like describe here under Tagging Places, enter the URL of an external Open Graph Object with a position, or the ID of a Facebook page. How you can search places via Facebook an thus get their needed ID, I explained in the previous post.
Thus the following code leads to the following result:

            string URL;
            URL = "https://graph.facebook.com/me/feed/";

            WebRequest MyRequest;
            MyRequest = WebRequest.Create(URL);
            MyRequest.Method = "POST";

            Stream DataStream = MyRequest.GetRequestStream();

            Byte[] Data = Encoding.UTF8.GetBytes("access_token=ACCESS_TOKEN&message=Getting ready for the game. Go Germany! But may the better win, good luck.&place=110346955653479");

            DataStream.Write(Data, 0, Data.Length);
            DataStream.Close();

            MyRequest.GetResponse();


No comments:

Post a Comment