I have a testing page on my site that simply lets users login. Once logged in, you can post a comment on the page (testpage.php). I am able to get the graph of the posted comments, but how do I search through those comments. I want to make a page where anyone can search through comments on testpage.php and all comments that match what was searched for would appear. how would I go about doing this? I have already looked over the facebook developement pages but they do not go into the details I need. Any ideas?
Referring to the Graph API page, https://developers.facebook.com/docs/reference/api/ (look for the Searching section) you cannot use the API to search for comments directly. You would have to get all the posts using the Graph API then perform your search separately.
Related
I have tried to get number of likes and shares of a facebook page in php. But I didn't get any proper solution for it.Please anyone can suggest me full code to get all these stuffs.Thanks in advance.
Using the Graph API you can retrieve the number of likes for a Facebook page.
https://developers.facebook.com/docs/graph-api/reference/page
In terms of "shares" as in how many times the page has been sent to another person by another it would depend on the tool you are using to share the page; Facebook doesn't track this itself within it's Graph API.
If you have a link on your page that says "Share our Facebook page" you could create something in ajax that would increment a counter on how many times someone had clicked that link, or if you are using a specific plugin to share the page you might be able to use their API to get some sort of count.
Again there is very little information on this question as to the problem you are experiencing, but hopefully this will give you the jumping off point to get started.
I am trying to show the comments from my facebook page post on my PHP website. I like the comments to be synced, so where the user enters comments on the facebook post of my page, it will automatically show up on my website. I know how to create the comment box, but it's doesn't pull the comments from the page.
for the comment box I have:
<div class='fb-comments' data-href='https://www.facebook.com/media/set/?set=a.182291248558753.39531.182290545225490&type=1&l=d607ba4dcc' data-num-posts='3' data-width='470'></div>
I am trying to show the comments that were left on my post, but it's not pulling it. I have looked at the graph API but can't figure out which on get the comments and how to get the so called "primary key" for the comments.
I have looked at the following fql:
Stream: but I don't know what the "post_id" is supposed to be. https://developers.facebook.com/docs/reference/fql/stream/
Comment: but I don't know what the "post_id","object_id", or "xid" would be for a post in a page of the an album. I even tried to replace the URL in the example post they had, but it seems like FB FQL can't parse that kinda url. https://developers.facebook.com/docs/reference/fql/comment/
Even when we get a list of comments, I am not sure how the fb:comments plugin can use the stream to populate my page, don't know if it's possible!
Any help would be greatly appreciated.
You could use Facebook PHP SDK for this which you can get from github. You can then use it to retrieve the comments from the post and store them in a database, updating every now and then to stay current. This will mean less requests to Facebook. When a user posts on your site using your form you can then send the post to Facebook using the SDK.
The problem with this method is that you will need to create an app and users will have to authorise the app for it to be able to post as them. So maybe it's not such a good idea, but I've typed all this in now so I'm not going to delete it.
everybody.
I am developing the facebook tab application. The functionality is pretty simple and is close to the blog.
Page Admin writes articles in the app, and the link to each article is posted on the page's wall via Graph API.
The wall post from step 1 contains a link to the application tab of the page with post_id passed via app_data parameter.
The article itself contains the facebook like and comments plugins on it. To attach this plugins I use the url of the external website on which pages are prepared for Facebook scraping (Open Graph tags and stuff).
And finally the question!
Is it possible to somehow manage the situation whenever user posts the comment inside an application tab, his comment automatically appears near the wall post performed in step 1?
I really hope that the question is clear. Any help, please?
You can publish comments to a Post via the Graph API:
https://developers.facebook.com/docs/reference/api/post/#comments
You will need to ensure that you have:
Requested publish_stream permission from the user
Indicate to the user very clearly that you are going to publish a comment when they do this (to do otherwise would not only break Platform Policy, but would be a crappy experience for users)
Subscribe to the Javascript comment.create event which is fired when someone posts a comment in a comments plugin: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
This has been asked before but I haven't seen a definitive answer. Hopefully someone has an answer. Basically, it seems impossible to pull any post that is geo-tageted via the API becasue it has privacy settings, that is, a country set to who can see it.
I am using https://graph.facebook.com/".$pagetoprocess."/posts?&access_token=".$att and this will pull the posts but not any posts that are geotargeted to the UK for example.
If I create an accesstoken from a user who is an admin of the page then I see all posts including geotargeted posts.
Why would this be? how can I see all posts for any page whether I am an admin or not or whether it is geo-targeted?
I would have thought that if you creaded an app in the UK and therefore had an app and secret id code from which you then generated a user access token, why would you not be able to see a post from a page geo-targeting the UK? Seems strange.
Any ideas?
Thanks
Jonathan
I would think that all posts would appear, or at least that is what it says on the api. You could try using feed instead of posts, since posts is a derivative. You might also try using:
&include_hidden=TRUE
But I'm not sure that will help.
If you have the page url, I'd be willing to see if I can play around with it in the graph explorer.
In facebook developers api page it says:
A Page in the Graph API.
The fields shown below are some of the common fields of Facebook Pages. Pages may also contain other (or additional) category-specific fields.
Does anyone know how to retrieve those additional category-specific fields???
I´ve been looking on Internet but not a clue :-(
The doc for the facebook 'page' table shows fields and lists what category of page they are available to:
https://developers.facebook.com/docs/reference/fql/page/
For example, the band pages have a 'band_members' field that no other page type has. You should also check out Facebook Graph API batch requests which you can use to query for something and use the result in a second request using JSONPath notation. Do a search on this page for JSONPath and you'll see it near the bottom under the 'Specifying dependencies between operations in the request' section:
https://developers.facebook.com/docs/reference/api/batch/
Hope that helps!
-Kyle