-1

I've searched the most related posts on this topic but I haven't found the answer. I don't understand code so I might not even notice it if I saw it.

but what I'm looking for is the code that allows me to post to my app users walls. but not just when they click the allow button, but any time after.

I know it can be done, I've seen the scripts that do this.

Hopefully I'm being clear enough, but I know the code that brings up the little box with some text in it when someone allows my app and they can click post or skip. that's not what I'm talking about.

I want the ability to post to their wall a week from now if I want to.

what is the code or script for that?

Kara
  • 6,115
  • 16
  • 50
  • 57
lou
  • 1

2 Answers2

1

In order to do this, your app will need to get publish_stream permission from the user to be able to publish to their wall. If you want to be able to do it any time after, you will also need to prompt the user for offline_access. These permissions are detailed here. To do the actual posting, you will need to do an HTTP Post to the users feed url. You will need an access token that you got from authenticating earlier. This is all well documented on Facebook's API documentation. You will care about the sections titled "Publishing", and "Authorization".

bkaid
  • 51,465
  • 22
  • 112
  • 128
  • ok thanks this seems very detailed. if i get the offline_access, do i need to get the basic info permissions? – lou May 30 '11 at 06:37
  • Basic info permissions is granted by default. So you should just need publish_stream and offline_access. – bkaid May 30 '11 at 07:32
  • Ok cool, now i went to facebook and read about publishing, cause i pretty much get the access token thing now. but i don't understand how to use that code they give to post? – lou May 30 '11 at 07:39
  • Their documentation uses the cURL utility app to access the url. But whatever programming language you are going to use will have a library for accessing a url and setting the http method to post. There are also SDKs for languages like PHP, C#, etc to help you do all of the Facebook calls much easier. – bkaid May 30 '11 at 07:42
  • Once again, he doesn't need the offline_access permission if he only wants to publish something. publish_stream is enough. – ifaour May 30 '11 at 17:51
  • It depends. He said he wants to be able to post to the users wall a week later, which I interpreted as doing it arbitrarily without user interaction and that would require an offline_access since the regular token will be expired by then. But if it is a week later and the user triggers the publish, then publish_stream would be sufficient. – bkaid May 30 '11 at 17:58
  • @bkaid: Not really, even if you want to post a week later without the user session you will be able to do so using only the publish_stream permission and the user id – ifaour May 30 '11 at 18:07
  • man....i sorta understand but this is still foreign to me. is there a good php course that you could recommend? – lou May 31 '11 at 18:28
  • @ifaour then when is offline_access needed? – bkaid May 31 '11 at 18:34
  • curl -F 'access_token=...' \ -F 'message=Check out this funny article' \ -F 'link=http://www.example.com/article.html' \ -F 'picture=http://www.example.com/article-thumbnail.jpg' \ -F 'name=Article Title' \ -F 'caption=Caption for the link' \ -F 'description=Longer description of the link' \ -F 'actions={"name": "View on Zombo", "link": "http://www.zombo.com"}' \ -F 'privacy={"value": "ALL_FRIENDS"}' \ -F 'targeting= {"countries":"US","regions":"6,53","locales":"6"}' \ https://graph.facebook.com/me/feed – lou May 31 '11 at 19:21
  • the code above is the code i would use to post to a users wall but i don't know how to even make it work.... – lou May 31 '11 at 19:21
0

As you haven't stated the language you prefer to write the code in, I would also generalize the answer, To be able to post to a user's wall when he is online and not online even, you need the publish_stream and offline_access permissions from the user while the user authorizes your application for the first time. You can get these permissions later by means of extended permissions. Now coming back to the point, if you want to post something to the user's wall at a later time, you can either do it manually by invoking a server side script that has the access_token with it, or you can invoke it using CRON jobs on a linux server.

Now, if i consider you want to use PHP as your language preference, you can check out these tutorials to get some help on serverside programming using the GRAPH API:

  1. TUTORIAL 1
  2. TUTORIAL 2
  3. TUTORIAL 3
Sujit Agarwal
  • 12,348
  • 11
  • 48
  • 79