twan twan - 1 year ago 68
JSON Question

Facebook api, some posts don't have an url to link to

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": "",
"story": "Lorem ipsum added 5 new photos.",
"link": "",
"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("");

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download