Facebook Graph API only get own posts without shared posts - php

I'm new to the Facebook API with PHP, and so far, I've succeeded in retrieving all the posts for my feed. But, I want to retrieve only the posts I have published, so nothing I have shared (that's what's included when I use the /posts) nor do I want messages placed on my feed by someone else (that's what I get using /feed)
Below an example of my call:
$data = file_get_contents("https://graph.facebook.com/$page_name/posts?limit=$limit&access_token=$access_token");
Any thoughts on this? Should I be using the facebook PHP SDK, or can it be done with a file_get_contents?
I have tried the "&with=" location filter, but I have no idea what that should do. Also I have tried adding "?filter=" app_$app_id, but that had no effect either.

As per CBroe's comment, this is not possible and needs additional code.

Related

How to get facebook page posts without using facebook api?

I am trying to make a simple webpage that will just display the most recent, let's say 5, posts from a certain facebook page. I have tried so many ways to use the Facebook API, but no matter what I do, it either returns nothing, or I get an access denied message. I am an admin of the page.
What is the best way to do this with PHP? If there is no other way to get facebook posts, what is the best way to use the API?
I would also like to get the post URL, not the contents of the post.
I found a way using zapier.com. Thanks!
First, you need to get either the user/page access token. Then, you will be able to get the last 5 posts using: https://graph.facebook.com/{YOUR_PAGE_ID}/posts?access_token={YOUR_ACCESS_TOKEN}&limit=5

In Graph API how can I get who mentioned me

I'm using Graph API to fetch my page feeds. I call
$pageID/feed?fields=created_time,object_id,story_tags,story,full_picture,picture,message_tags,message,caption,child_attachments,attachments,description,admin_creator,from
It gives me the feeds in my page which is fine. But, I also want the list of posts where anyone has mentioned my page in their posts in their own walls. I have gone through https://developers.facebook.com/docs/graph-api/reference/v2.9 but could not find a way to do that. Does anyone has any idea if that is possible?
If yes, then how?
There is the /{page-id}/tagged endpoint; but that will only return posts by other pages that have tagged yours, and only if those pages are “authentic” (which likely means verified.)
And user posts are not available at all to your app, not even if they are public - unless the user explicitly granted your app permission to read their posts.

get facebook posts (and older posts) without access token

i already found a way to get posts without an access token:
https://www.facebook.com/feeds/page.php?format=rss20&id=121136164607942
https://www.facebook.com/feeds/page.php?format=atom10&id=121136164607942
With the URLs above you can get the newest posts, but what about the older ones? I basicly wanna achive what facebook already got (load the newest posts and then there will be a button "load more"). Including an IFrame is not an option. I want to make the facebook posts responsive.
Does somebody know if theres a way to get the older posts? I already tried adding &offset=10 but it doesnt seem to affect anything.
The old Page Feed endpoint will stop working soon. Use /v2.3/{page_id}/feed instead, then you can also use the since parameter.
See
https://developers.facebook.com/docs/apps/changelog#v2_3_90_day_deprecations
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#paging
Page RSS Feed endpoint - at https://www.facebook.com/feeds/page.php is now deprecated and will stop returning data from June 23, 2015. Developers should call the Graph API's /v2.3/{page_id}/feed endpoint instead. This returns JSON rather than RSS/XML.

Searching twitters public timeline using JQuery

So a while back I used to use the twitter json search in one of my apps but it seems since the change in API versions there has been some major changes which even after reading the documentation I still can't get my head around and it really doesn't make it very easy to understand so hopefully one of you tech guys out there can help me out.
I want to clean my application up so it works again in plainly doing the following:-
http://search.twitter.com/search.json?
q='+param+'&
rpp=100&
result_type=recent&
lang=en
Obviously with the changes this is no longer possible but I want to be able to do this again using the new address but in JQuery unless someone can suggest either a tutorial or a piece of code or even a link to a topic where I could get my answer. I'm also open to using PHP as this is what I used at one point with searching Facebook's timeline and you can get an access token using $.get() for Facebook so surely it would be the same with Twitter too?
Any advice/code is welcome.
Thanks!
the search API needs authorization now. I'd say that, first off, you need to call the https url not http.
With Abhramam William's library you'd do something like the following, after having received your app's bearer token:
$your_tweets = $connection->get("https://api.twitter.com/1.1/search/tweets.json?q=from:grey_mina&result_type=recent&count=5");

Why do geotargeted posts not appear in API even with accesstoken?

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.

Categories