Reputation: 2659
I am getting some data in json format and putting it into a custom facebook feed on my website.
But I noticed some urls are not working, because it doesn't get a link to the post, while others do have a link.
What is the reason for that?
Example (I edited the real data):
{
"full_picture": "facebook.com/image.jpg",
"story": "Lorem ipsum added 5 new photos.",
"link": "facebook.com/loremipsum",
"updated_time": "2016-04-21T08:11:56+0000",
"id": "267007566742236_9112352353963611923"
},
{
"message": "lorem ipsum",
"updated_time": "2016-05-26T18:58:50+0000",
"id": "267007566742236_90323523789831074"
},
Like you can see, one has a link, but the other doesn't. If I go to the facebook page and click on the date of the post, it opens in a new tab, so there should be an accesible url.
I get everything with file_get_contents:
$json_object = file_get_contents("https://graph.facebook.com/v2.6/267032532566742236/feed?fields=full_picture%2Cmessage%2Cstory%2Clink%2Cupdated_time&access_token=23532523523523%dsgsdg322352352235");
Upvotes: 1
Views: 42
Reputation: 96324
The link
property of post objects is for the URL that might have been attached to the post.
What you want, is the permalink_url
field.
Upvotes: 1