I have built a simple webpage in PHP. I want to tell if users like my page (I placed a like button on it). It is not a Facebook app. I have seen this, but don't know how to use it with PHP. I don't know JavaScript at all. I tried pasting the code listed at the link into my page, but it didn't do anything useful.
A PHP solution would be preferable. I don't want to build a Facebook app, I just want to know if the Like button has been pressed.
Any help would be appreciated. Thanks!
Edit: Here's the link to my website, per answerer request: testingground.comyr.com
Those Edge events are only usable to detect if the user clicked the Like Button right now, but you cannot check if he already liked your page. That is only possible with an App, and user authorization with the "user_likes" permission.
More information:
Check if logged in user has liked my Facebook Page
Check if user liked page or not
Why don't you use the Facebook developer reference documentation?
Without an API Access, I think there is no possibility to do that.
How should you have access the private token what a random user liked?
Related
I'm looking to securely lock content on a basic html site based on various permissions of the user. I'm looking to have a pop-up modal appear when the user's permissions don't check out... however it seems to be that any savvy user could simply open the console and delete that element (thus revealing the page anyways).
What am I missing here? What's the best way to approach this so that no matter what the actual page can't be accessed?
Thanks in advance for the help!
If content is downloaded to the client, it's always technically possible for a savvy user to access it.
You can either live with that, or alternatively do something like the following:
Load the basic page template without any content
Use an API call using cookies/other auth to get the content
If logged in, display the content, if not, launch the modal.
Ok here is my answer to this one.
The answer given was agood one, you can't hide the content truly so your options are:
Don't download all the stuff you want until you have auth'd the user (via cookies etc.
Use a simple redirect/buffer page infront of your hidden content.
In my use case (shopify) partial downloading of store content isn't exactly configurable (or i don't have enough knowledge of their template language + theme design to pull it off!), so I made use of javascript and cookies in order to check a user's status. If the user didn't pass they'd get kicked back to a landing page. Good enough!
Use Case: I want to create a login button for "Login with Facebook". I want this functionality to be implemented using c# or asp.net with JavaScript or with JavaScript alone.
Requirements:
1) On the click of "Login with Facebook" button a pop up asking for email address should be visible.
2) When the user enter(s) the email address then a verification email is sent to the user.
3) When the user clicks on the "Verify" button in the email, then the user gets redirected to the Home page.
4) On the home page a pop appears asking user to provide permission to access the facebook details.
5) When the user finally allows it, it gets login from his facebook account.
Can anyone provide me a explanation for the above task? Any help will be greatly appreciated. Thanks in advance.
You should just use OAuth2 and follow the recommended process by facebook. Have a look at the documentation of the facebook graph API here.
Remember to create a facebook developer account here.
If youre using ASP.NET, there is an included Facebook OAuth2 client. Have a look at this link here. Its actually pretty easy to accomplish a simple facebook login and retrieve an access-token.
I know thats alot of links but you will have to first read a bit about the whole process to understand how it works.
Hope this helps and good luck.
The samples I do find online are all about using the Twitter button.
Reading the Twitter Post API it's not clear where to place the code. It seems they are just telling the params expected, but not how the code should look like
I'm soooo confused with this API (:
Well, my need is to place my on my own website my own button. When the user clicked on it, I want to call my a Javascript function that should do the following:
1) Check if any user is logged in
2) Login, if not
3) Check if my Twitter App is already installed on the logged in user
4) Request permission, if not
5) Post a message on his timeline
In fact, I don't even know if I need a Twitter App in order for people to post on their own timeline from my website?
Anyhow, I'm looking for something I can put on a single JavaScript function and that does not involved any Twitter specific button.
I would imagine this to be the simplest of any Twitter APIs but somehow all samples I keep finding online refer to use the Twitter button.
I know this question has seemingly been asked. Without solution.
That said, I did try to do my research on it and I haven't found a complete solution.
I'm trying to create a login system for google sites. Login on the homepage and until you do you cannot view any other page or be able to access it. That said, I'm honestly struggling with the of viewing other pages, so how would I do that?
I have considered making the menu myself and disabling the normal one - but then couldn't they just type the url www.site/page-i-don't-want-you-to-see?
So what's the solution? Adding googlescript on every page to verify? EDIT: Very noteworthy to point out: https://support.google.com/sites/answer/1387646?hl=en&ref_topic=1387383 there is page restrictions if you want to do it manually. A bit impractical when you could to sites that should have a decent number of people.
What I DO have done right now is a login app using a spreadsheet ( Don't worry - passwords are encoded. Only reason I am using a spreadsheet and not a database is I'm making the site for someone else as well) which you can create an account and try to log in.
I'm going to put the login app on the homepage, and a login checker on every page so essentially the question becomes: How can I redirect using a appscript? I tried the html redirect method using a refresh and a url which hasn't worked and a few not noteworthy javascript methods all that have failed.
Edit: Bump!
A client of mine (a design studio) asked me to style the like-box social plugin on their site.
As far as I know this cannot be done now with the deprecation of "css" parameter on the fbml tag.
So the route I have to take is to recreate the like-box myself using the js SDK (or php SDK), but the problem is that I cannot find the users (and their photos) that like my page. I'm searching through the opengraph explorers parameters but i cannot find anything.
Does anyone know which url I must follow in the graph api to get what I want?
Do I have to have an access token for such an action? I noticed that the likebox plugin works event if you don't have a facebook account (It shows pictures).
Thank you.
You can't recreate the like box on your own. The Facebook APIs will not return a list of users who like your object. This was done to stop people from getting user lists of likers and spamming them.
Currently, you can only query to find if a specific, authenticated user or which of their friends likes your object.
You could build something similar by populating your fake like box with images of recent posters. You would need to deal with filtering out duplicates, and the page posting as itself, but this should get you started: /PAGE_ID/feed?fields=from.name,from.picture&limit=10
You will need an access_token to get this data. I'd authenticate as an app to do it.