Get facebook faces using the graph api - php

I want to make a facebook box on my website, with a custom Like button to like our facebook page. And in text a line like: 8763 people like our facebook page. I can build both these using the graph api and json_decode().
But is it also possible to get 10 pictures of the people who liked my page? It's something the designer brewed up, and Im told to just make this. :)
Gr.

Not possible in a straightforward way, only friends of the current authenticated user.
SELECT uid FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND page_id = "xxxx"
You could look into grabbing the ids from http://developers.facebook.com/docs/reference/api/page/#conversations hold them in array with only unique ids up until 10.
Also http://www.facebook.com/brandpermissions/logos.php
We permit the Facebook Like Button logo to be used in connection with the Like button social plugin, which enables users to make connections to your pages and share content back to their friends on Facebook with one click. We also permit use of the Facebook Like Button in offline advertising (e.g., print advertising) to reference and direct people to your Facebook Page or your website that has the Like Button social plugin implemented. We do not allow the use of the Like Button logo in online advertising. Please see the Usage section below for more information.
Which to means you cannot have custom Like boxes or buttons, so be sure you are not breaking policy

If you already have the user ids, then it’ll be really simple – see “picture” connection on https://developers.facebook.com/docs/reference/api/user/

Related

Tracking individual visitors in Wordpress and Google Analytics

Here is what I'd like to achieve: I have a landing page and a list of contacts. I want to send each of my contacts the link and be able to see the analytics (duration, visitor flow, conversion) for each individual. Most importantly, I just want to confirm they visit the link.
What I'm thinking of doing is using a Wordpress URL parameter to add a unique identifier to the page for each contact, and then track those pages in Google Analytics.
What is the best practice? Is there a better/faster/easier way to do track individual visitors in Wordpress and Google Analytics?
You should be building your own url for each user. I would build a url first with this link, then write a script or something to create a unique url for each user in your contacts list.
https://support.google.com/analytics/answer/1033867?hl=en
Hope that helps!
EDIT: You can also try just adding ?contact_id=99999, visit the link and then go to Google Analytics, look at the live view, and see if your parameter shows up.
Whats Happening Now: http://analytics.blogspot.com/2011/09/whats-happening-on-your-site-right-now.html
Parameters do show up in GA because on most shopping carts each page, product etc have url parameters that are unique, and can be viewed from GA. If it didn't most website applications would not be compatible with GA.

Facebook like button and OAuth Access

I am connecting to the Facebook API using HybridAuth on the server side (backend is written in PHP). This is for a SaaS publishing application that is hosted on our servers. I understand the mechanics of OAuth and that once I accquire the appropriate permissions from the user, I can write and read from the Open Graph API, which in theory will allow me to do almost anything.
The problem is that I would like to use some of Facebook's social plugins. In particular, I would like to implement the like button so that it automatically appears for each blog post, article and page.
The problem is that the like button and the various Facebook plugins require an app_id. I would prefer not requiring users to add the developer app to their account and creating an app to get an app_id as it can be a confusing process for non-developers.
Is there anyway we can create or retrieve an app_id from open graph (which we can store and use to generate the like buttons and other facebook widgets)?
With the migrations, I understand that each liked URL will not have it's own page. Once the user clicks a like button on your site, he automatically likes your page. However, let's say I have a page called http://www.mystore.com/products/some-awesome-product and there are other similiar pages, all with a like button. Is it possible that when clicking like, the user automatically likes our Facebook page, but when an item is published in their news feed for the like, the URL links to that specific product? Effectively, is there a way for users to like multiple pages from my site?
Update: It looks like we can generate app_ids programmatically with the create application API in the legacy REST API. However, this does not seem to be an option with the graph API.
Seems like we cannot programatically create an app_id for an account. This is not an issue, as we will just create a small guide to guide our users through creating an app and submitting the app_id to us using a form. Not perfect, but should be easy to implement.
As for URLs, liking something will not automatically like your Facebook page. If href is blank, the current page will be liked. If you set your facebook page in the href parameter, then your facebook page will be liked.

PHP posting on page wall

I have a website where users can post jobs for free. How can I link these posts to a facebook page about this website? I don't want the users to login to fb.
At this moment I post them to twitter and then using selective tweets to post them on my page. But selective tweets is not able to post logo's specific for that job.
I created a fb app. Did not select anything just gave it a name and got an appID and appSecret. I dont now what to select in "Select how your app integrates with Facebook". Becouse it is not a mobile app and it is not a website with fb login.
Kind regards.
you can use share on facebook facility of facebook ,from http://developer.facebook.com.
you can easily add this to your website.
have fun!
You can do this easily via MYSQL and PHP, depending on how your current site is setup. What i would do is store the jobs into a separate table while saving, like this
(table) Facebook
pageid //numerical value
header //job title
message //job description
So that you can use it for the next part.
Create an application via Facebook and give it authentication to users and your Facebook page.
by adding this application to your page you can then call something like :
$facebook->set_user($user, $session_key);
$facebook->api_client->stream_publish($item['header'], $item['message'], $item['pageid']);
Using your keys from facebook.
Then you can run a Cron that updates every x minutes, and after it has posted it, in an array, you can clear the table for the next row of jobs.
Let me know where you are on this and ill try to help as much as possible.

How can I fetch my Facebook status (online or not) and manipulate it in PHP?

I'd like to display my chat status on my website, so I can tell my customers they can reach my through Facebook chat. Is there any way to do it?
Try this link:
http://developers.facebook.com/docs/reference/rest/status.get/
or search on "make an FQL query (fql.query) on the status (FQL) table", taken from that same link, which should do you nicely.
I guess you could make a PHP script that uses the status.get or fql.query (on status table) to pull your status on page load. Maybe place it in the header/footer that is shared across your site. This way as soon a someone comes to your page they'll see your current FB status.
Why do you want to do that? Customers can't even use the chat if they aren't friend with you ?
Just create an anchor from your facebook profile page

How to login in website using facebook id

I have made a website on which a user has to log in using a username and password. I have seen these in so many website, we can connect through facebook account. And I want to add the same to my web site. How is it possible,using php sdk or the javascript sdk?
The team at Facebook has spent considerable time documenting this, I would suggest you start there:
http://developers.facebook.com/docs/guides/web#login
http://developers.facebook.com/docs/authentication/
If possible, I would do like dracolytch writes here and create a level of abstraction for both OpenID and Facebook. He is willing to share his code.
Those links are what Facebook likes to call "Badges." Go to your profile. Scroll all the way to the bottom. On the lower left hand column you should see a link that says "Create Profile Badge." Click that. From there you can edit a Badge to show the info you'd like. At the end, it will give you some html code that you can copy and paste into another website or blog. When people click on your Badge, they will get sent directly to your Facebook info box.
Source(s):
http://www.facebook.com/badges.php

Categories