Facebook Graph API - get all user's liked pages - php

I would like to retrieve all facebook pages liked by a certain user.
The problem is that a /user/likes endpoint returns the list in parts (pagination).
Is there an option to display them all in one page? Facebook docs do not provide such info.
P.S. pagination does not seem to return all the pages. Some of them are missing.
10x.

There is no way to get all pages in one call, you have to use pagination. If pages are missing, you should file a bug.
Btw, you can also try setting a limit:
me/likes?limit=100
...but there is a max value for that, so you can never be sure to get all pages in one call without paging.

Related

Facebook Graph API Explorer get page specific page feeds

I use Graph API Explorer to get some feeds from my facebook page. So I have something like this:
GET ->/v2.2/my_page_id/feed
which returns me all the feeds from my page. At this point everything is well, the problem is that it returns not only the posts I posted, but also the posts other posted on my page.
What I basically want is to get only my posts which are placed in the center column without the other peoples posts on my page which are placed on the left column.
If I try this:
GET ->/v2.2/my_page_id/feed?fields=from{id}
I will get only the user ID who posted the feed, so I guess I have to put some kind of where clause like :
/where?from{id}=my_user_id
Can anybody help me with this? It seems such a simple thing but I lost lots of hours to make research about this where clause without any luck.
You should use
GET /{page_id}/posts
instead of
GET /{page_id}/feed
if you just want to Page's own posts.
See
https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed/
/{page-id}/posts shows only the posts that were published by this page.

static graph or widget out of piwik for pageview evolution of single page(name)

What I need is the evolution of pageviews for a single Page Name, shown in a graph, available as widget or static image for embedding in another website.
In the Piwik website itself, this graph is available: go to Actions -> Page Titles, and hover over a certain page title -> two icons appear, one of which ('open row evolution') leads to the graph I want to export.
Through the API, I'm able to get statistics on my single page:
index.php?method=Actions.getPageTitle&pageName=PageNameIWant&date=last10&period=month&module=API&idSite=6&token_auth=anonymous
And I can also generate a graph:
index.php?module=API&method=ImageGraph.get&idSite=6&token_auth=anonymous&period=day&date=last100&apiModule=Actions&apiAction=getPageTitles
But I can't seem to find a way to combine the two to generate a graph showing the pageview evolution of a single page. Note that the first call uses the 'getPageTitle' method, while the second uses 'getPageTitles'. Using 'getPageTitle' in the second call generates an error (not supported)... I'd leave it at that if it weren't for the fact that the actual graph I'm looking for is available on the Piwik website itself, so there probably is some way to generate it.
The "label" option can be used for filtering for apparently any call that has multiple resulting rows.
index.php?module=API&method=ImageGraph.get&idSite=6&token_auth=anonymous&period=day&date=last100&apiModule=Actions&apiAction=getPageTitles &label=PageNameIWant
If you have many pages and you're getting a "No data for this graph" as result, possibly the page you're asking for is not one of the more popular. I'm not having this issue myself, but if someone in future does and reads this: there's a filter or filter_rows option which you can set to 0.

PHP displaying page views for gallery style pages

This is really a point me in the right direction question. What path should I take if I want to display the number of page views each gallery page receives?
Retrieve Google Analytics Data via PHP, or
Capture the page views directly on my pages with my own PHP and mySQL setup?
Seems, like number 1 would be the better choice. I just don't know how difficult this option will be. Any insights on this?
Option 2 is definitely simpler.
If you do figure out how to get the page results out of Google Analytics, they will not be up-to-date. It takes Google at least several hours before the page views show up.
That also depends if You want to have info on more questions (statistics). I often use custom setup to track such things cause I can later use some data to do statistics about users actions.
For example, You want to give users (owners of photos) info about witch users (male or female, 30+ or below 30, and so on) are viewing. How many guests, how many registered users. There are tons of data You can retrive by building custom system.
It all depends on what You want to have at the end.
I suspect that if You want to have only raw data about number of users You coud somehow parse data from Google Analytics as well.
And as posted below. Google have to take time to update, custom setup not.

parse facebook page query

I was wondering if someone knew a way of parsing the results of a query done through the search bar in Facebook. I don't manage to get around that "see more reults" button at the end, and I would like to find a way of getting all the results of the search.
I guess a DOM parser is not the solution, since it will only scan the results available on the page:
DOM to parse Facebook wall
Thank you in advance!
Guillermo
The problem is, all the results that show after "see more results" is clicked is loaded dynamically via AJAX. Your goal, then, will be to replicate that functionality by manually calling the URL that Facebook calls and getting the results from that (provided that Facebook doesn't use unique tokens to validate the loading of more results in the URL).
I would suggest that you see if you can find the URL that Facebook uses to load more search results.

How to query full page from a phpbb forum?

I want to write an app that parse particular threas on a phpbb forum. So if a thread has 200 pages with 10 posts (that doesn't give you the ability to adjust the post count per page), and has an address like this:
http://www.forum.com/viewtopic.php?t=10&postdays=0&postorder=asc&start=0
where start parameter changes when you navigate to the next pages of the same thread, how do you get the full thread in one go?
I tried:
http://www.forum.com/viewtopic.php?t=10&postdays=0&postorder=asc&start=0&end=2000
but didn't work.
Surely there must be a way to do this I imagine.
If you're parsing, just parse each page, then add up the results in the end. If the forum doesn't have an open API, or any way to display all of the posts on one page, this is what your are going to have to do. Perhaps you could write a recursive function that checks for a 'next page' link or something similar, follows it, then returns all of the data from the pages compiled.
EDIT: looking at example url you gave, have you tried changing the t variable? you said it was 10 posts per page, and that was set to 10, so maybe that's what controls posts per page.
http://www.forum.com/viewtopic.php?t=2000&postdays=0&postorder=asc&start=0
Some super handsome fellow wrote a MOD for this if it is your forum:
http://www.phpbb.com/community/viewtopic.php?f=69&t=1101295

Categories