facebook post from php through graph api - php

i use this code to authorize me with my app
https://graph.facebook.com/oauth/authorize?client_id=myappid&scope=publish_stream,offline_access,manage_pages&method=post&redirect_uri=http://www.site.com/indexold.html
i get the access token and i use this to do the Impersonation trick
https://graph.facebook.com/oauth/access_token?client_id=myappid&client_secret=myappsecret&redirect_uri=http://www.poemsofloveapp.com/indexold.html
lastly i use this to post to my page ... not the app page but a page i have created
https://graph.facebook.com/mypageid/feed?access_token=1234|asdasdasdasd&message=hello%20world&method=post
the post is successful but it is shown as i have posted it . i want the profile picture of the group to be shown next to the post is this possible? instead mine is shown next to the post!

What you are looking for is called impersonation in facebook graph api terminology.
Check here
And, also here

Related

How to get like count of an FB page in graph sdk (PHP)?

I've recently been working with the graph API for Facebook and i want to create a script that lets me input a page_id and will then return the like count of the specified page.
I've already taken care of getting an access token and logging in, but i can't seen to find anything concerning the total like count of a page in the Reference.
This would be the API call:
https://graph.facebook.com/bladauhu?fields=fan_count&access_token=xxx
You can use any Token if the Page is not restricted by age or location. If it is restricted, you need a User or Page Token of a user who can see the Page.
More information:
http://www.devils-heaven.com/facebook-access-tokens/
https://developers.facebook.com/docs/facebook-login/access-tokens/

How do I display visitor fullname on my facebook fan page welcome tab?

I have created my fan page using Page Tab.
Now I want to display visitor Full Name on that page.
Example : Hello Fullname
It's possible without authentication?
I suggest using the Javascript SDK to achieve this, here's the documentation
... and in answer to your second question, you'll need to get authorisation of use user for your app to make any Graph API request.
You'll need to get the user's name by doing an API request to /me?fields=name get the username.

Facebook add POST to page

I've managed to automattically add a post to my profile using /me/feed/ , but how can I add a post to a page created within my account ?
they say " /[page id]/feed/ " how can I find the right page ID ? Do I need to use another method to post to my facebook page ?
I've searched on how to get the page ID, I've obtained and used this ID: 123397591098452 for page: http://www.facebook.com/pages/Siteique/123397591098452 but the post is not working.
Note: the application has all the right privileges.
This is the way i`m sending the post:
$facebook->api('/me/feed/','POST',$post);
Try logging into your app under the account the the page belongs to, then turn the code into an oauth token, and then use that oauth token with your request. Good Luck

Can a page tab post to a user's wall?

I have a Facebook application used as a tab in a fan page, that displays different information depending on whether tha user is a fan of that page or not.
Now I've been asked to have it post a message to a user's wall if they perform certain action (follow a link or whatever), and so far I haven't found a way to do that. All the documentation I have found refers to stand alone apps, and I've even seen it suggested (in the FB forums) that you can't get the auth token from an app.
So, i still think it can be done, but how?
If a user has authorized your app, you can post to her wall using the PHP SDK. See the PHP SDK api documentation for examples.
All apps have to be iframe apps now, so loading the JS sdk should be fine.
You have to get permissions first ->
http://developers.facebook.com/docs/authentication/#applogin
Then you can post using php with what Dhiren said, or, post with the fb.api function with JS ->
http://developers.facebook.com/docs/reference/javascript/FB.api/
Let me know if you need an example script.
Cheers

Facebook post to wall

I have a Facebook Application Profile Page that I would like to create a custom script to perform wall posts on its wall. The reason I need this is because the existing Facebook "Post to Wall" functionality does not post the pictures I want it to.
What I need is a PHP webpage that allows me to do this:
Inputs:
App ID (App ID of the Facebook App that I am looking to post to wall)
API Key
App Secret
URL of Image to post
Message Body
URL of link
Output:
the post is made to the wall of the Facebook App Profile page, so that anyone who has "liked" the page can see it.
Any ideas, brainiacs?
That's all supported by the graph api, you'd need to submit to http://graph.facebook.com/app/feed with the post submitted as POST data (message), and of course an access token. If you use Facebook's own php library, there are functions which will implement the api calls using the curl library for you.
If you haven't used the graph api before, you should start reading their developer resources at http://developers.facebook.com/docs/reference/api

Categories