2

I would like to add a Facebook Like button inside my software.

I know how to programmatically do the actual liking process, but how do I check and see if a person actually has liked my page?

Edit: I'm guessing that my software also has got to communicate with an actual Facebook App that I have to develop, and not Only with a regular facebook html source?

xaid
  • 740
  • 6
  • 18
  • 1
    What mechanism are you using to communicate with FaceBook? – David Heffernan Feb 26 '13 at 15:49
  • 1
    do you need to know the total number of likes for this page, or if a specific single person likes it? – mjn Feb 26 '13 at 16:35
  • @David Heffman I am usin Chromium Embedded Framework for Delphi. Google CEF or CEF3. CEF3 is newer but it's hard to get it to work properly. I prefer CEF. – xaid Feb 26 '13 at 16:41
  • @mjn Well, both would be nice. But most important is to know if a specific person likes the page. – xaid Feb 26 '13 at 16:41
  • How do you intend to get the current user's facebook id so that you can know if the given user has already liked the page? – dthorpe Feb 27 '13 at 05:56
  • @dthorpe I thought that maybe it could work the same way that other websites use to connect to facebook. I think its called a facebook app, so I guess that I would need to connect my software a custom facebook app which then does the liking process and stores it a server so that my software can read whoever likes and does not like my page. – xaid Feb 28 '13 at 22:57
  • I think the "facebook app" that you refer to is the javascript button intended for inclusion in html web pages. The easiest way to incorporate that into your Delphi app is by dropping a web control on your Delphi form. Using a browser control will also automatically pick up browser cookies with the user's Facebook id, so the FB javascript can show whether the current user has already liked your app or not. – dthorpe Mar 01 '13 at 01:26

2 Answers2

4

Have you considered dropping a TWebControl on your Delphi form, assigning a simple HTML document string to it that contains the markup needed for a Facebook like button and making it just large enough to display your facebook like button content?

The like count and user liked state would be handled automatically by the javascript dynamically loaded into the html page. The javascript written by Facebook.

Seems like a full-functionality, least-effort approach worth considering.

dthorpe
  • 35,318
  • 5
  • 75
  • 119
3

I don't have Facebook to test this, but try to use what is described in this blog post; try to use the following HTTP GET request and in the response (after you parse it), find the user you're looking for:

https://graph.facebook.com/me/likes/PAGE_ID&access_token=ACCESS_TOKEN

Where PAGE_ID should be your page ID and ACCESS_TOKEN your access token. For a simple GET request you can use e.g. this code.

Community
  • 1
  • 1
TLama
  • 75,147
  • 17
  • 214
  • 392
  • 1
    +1 for "I don't have Facebook to test this". One more +1 for still trying to help! – ssh Feb 26 '13 at 22:40