PHP to create single array from multiple Facebook pages
- or -
Post a project like this2537
£40(approx. $50)
- Posted:
- Proposals: 1
- Remote
- #1527346
- Awarded
Description
Experience Level: Intermediate
Estimated project duration: 1 day or less
General information for the website: Merge 5 facebook page posts into single JSON PHP
Num. of web pages/modules: 1
Description of requirements/features: I have been having a problem parsing 5 facebook pages posts into a single feed in order to use this as the core news page on a clients website.
I have access tokens and page IDs for each of the pages and this shouldn't take long for a well-versed PHP developer. I even have a working script example
Extra notes:
The JSON feeds I have operational presently collate the 5 IDs into a single result but I need this to be sorted by data and then re-arrayed to show only the post data.
Sample of the results so far are:
[
{
"1653383931615913": {
"posts": {
"data": [
{
"message": "The babies\/ toddlers all had fun taking a turn of Lisa's pinocchios fleece this afternoon",
"created_time": "2017-04-06T16:22:39+0000",
"picture": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/q82\/s130x130\/17799100_1873883449565959_2114197635365750530_n.jpg?oh=fa247800017ec53216e0e355bce24cf5&oe=59613649",
"id": "1653383931615913_1873885569565747"
},
{
"message": "Massive well done to all our little creators who have designed their eggs and raised lots of money for the Sick Kids Foundation! \u2728\nDon't worry if you haven't handed your child's egg\/sponsor form in yet, I will be picking a winner from each room on Thursday 6th April. \ud83c\udfc5\n\nThank you for all your support with raising money for such a great charity. \u2764\ufe0f",
"created_time": "2017-04-03T17:57:41+0000",
"picture": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/s130x130\/17760188_1872137036407267_900552020946250032_n.jpg?oh=24f0f23186da592f0481473088a4bdf0&oe=594CDA5F",
"id": "1653383931615913_1872137036407267"
}
],
"paging": {
"previous": "https:\/\/graph.facebook.com\/v2.8\/1653383931615913\/posts?limit=5&fields=message,created_time,picture&since=1491495759&access_token=250579172080417|931cf82aff14141c268f8d6c48050d96&__paging_token=enc_AdC922gpSs8FwPlqhDYeV5NqWiAIpMtlbTRWG6P7oK5ljZB3vmhznRD8F5VflxmO4AYsZA7thqddb2KL40UnO2SHdazx7rEESNoh7FZAwexyNPOsQZDZD&__previous=1",
"next": "https:\/\/graph.facebook.com\/v2.8\/1653383931615913\/posts?limit=5&fields=message,created_time,picture&access_token=250579172080417|931cf82aff14141c268f8d6c48050d96&until=1491242261&__paging_token=enc_AdC7KZAFZCvg8A2lUrp0B0f4ZBfQ0VvgldqMIGbuh8ecAwZBSiVa0We4aK5PLo16eKI2K85VHrRrzDfJOf52SEIEeYR2P7XkZArerk6FeWLMYlI33HwZDZD"
}
},
"id": "1653383931615913"
},
"393984274115232": {
"posts": {
"data": [
{
"message": "A massive well done to Megan our Preschool decorated Easter egg winner!! Beautiful pattern and detail you added!! \ud83d\udc23\ud83d\udc30\ud83d\udc90",
"created_time": "2017-04-07T11:13:44+0000",
"picture": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/s130x130\/17799064_720231804823809_1070934086465760221_n.jpg?oh=c57e7fbeb013dc8b0acee7921ec7b82a&oe=598AE465",
"id": "393984274115232_720231804823809"
},
I will need the paging elements removed so only post data is in the final JSON output
Num. of web pages/modules: 1
Description of requirements/features: I have been having a problem parsing 5 facebook pages posts into a single feed in order to use this as the core news page on a clients website.
I have access tokens and page IDs for each of the pages and this shouldn't take long for a well-versed PHP developer. I even have a working script example
Extra notes:
The JSON feeds I have operational presently collate the 5 IDs into a single result but I need this to be sorted by data and then re-arrayed to show only the post data.
Sample of the results so far are:
[
{
"1653383931615913": {
"posts": {
"data": [
{
"message": "The babies\/ toddlers all had fun taking a turn of Lisa's pinocchios fleece this afternoon",
"created_time": "2017-04-06T16:22:39+0000",
"picture": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/q82\/s130x130\/17799100_1873883449565959_2114197635365750530_n.jpg?oh=fa247800017ec53216e0e355bce24cf5&oe=59613649",
"id": "1653383931615913_1873885569565747"
},
{
"message": "Massive well done to all our little creators who have designed their eggs and raised lots of money for the Sick Kids Foundation! \u2728\nDon't worry if you haven't handed your child's egg\/sponsor form in yet, I will be picking a winner from each room on Thursday 6th April. \ud83c\udfc5\n\nThank you for all your support with raising money for such a great charity. \u2764\ufe0f",
"created_time": "2017-04-03T17:57:41+0000",
"picture": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/s130x130\/17760188_1872137036407267_900552020946250032_n.jpg?oh=24f0f23186da592f0481473088a4bdf0&oe=594CDA5F",
"id": "1653383931615913_1872137036407267"
}
],
"paging": {
"previous": "https:\/\/graph.facebook.com\/v2.8\/1653383931615913\/posts?limit=5&fields=message,created_time,picture&since=1491495759&access_token=250579172080417|931cf82aff14141c268f8d6c48050d96&__paging_token=enc_AdC922gpSs8FwPlqhDYeV5NqWiAIpMtlbTRWG6P7oK5ljZB3vmhznRD8F5VflxmO4AYsZA7thqddb2KL40UnO2SHdazx7rEESNoh7FZAwexyNPOsQZDZD&__previous=1",
"next": "https:\/\/graph.facebook.com\/v2.8\/1653383931615913\/posts?limit=5&fields=message,created_time,picture&access_token=250579172080417|931cf82aff14141c268f8d6c48050d96&until=1491242261&__paging_token=enc_AdC7KZAFZCvg8A2lUrp0B0f4ZBfQ0VvgldqMIGbuh8ecAwZBSiVa0We4aK5PLo16eKI2K85VHrRrzDfJOf52SEIEeYR2P7XkZArerk6FeWLMYlI33HwZDZD"
}
},
"id": "1653383931615913"
},
"393984274115232": {
"posts": {
"data": [
{
"message": "A massive well done to Megan our Preschool decorated Easter egg winner!! Beautiful pattern and detail you added!! \ud83d\udc23\ud83d\udc30\ud83d\udc90",
"created_time": "2017-04-07T11:13:44+0000",
"picture": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/s130x130\/17799064_720231804823809_1070934086465760221_n.jpg?oh=c57e7fbeb013dc8b0acee7921ec7b82a&oe=598AE465",
"id": "393984274115232_720231804823809"
},
I will need the paging elements removed so only post data is in the final JSON output
Mark L.
100% (19)Projects Completed
25
Freelancers worked with
23
Projects awarded
46%
Last project
20 Dec 2017
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Hi Mark,
what do you mean by "sorted by data" based on which criterion?
Thank you,
LucyMark L.07 Apr 2017there is a key "created_time" within the JSON feed and I would like this to be array sorted in DESC manner (i.e. newest at the top)
383648
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies