Create button like Digg button - php

I am building a news aggregator. How can I create button/ widget like Digg button or Facebook Share button that web developer can embed in their own website. When their users click on that button, it can trigger some function that interact (eg: voting or display vote amount) with my server. Thank you.

Simple solution: You need PHP script that accepts GET parameters. The third party can send data payload in the GET parameter and your script can read them and do the needful.
Voting third party via button shouldn't be done via GET params. This will create bad voting attacks. What you can do is make an API for your third party systems and have them do a CURL request to your API with the POST data payload. Again, this isn't the most secure. To make it more secure, use the API key and domain / IP check.
If your system is based on user sessions, you can do a cookie check to determine USER Information and read values. (similar to facebook LIKE).

Related

Make facebook notify if an URL has hit a like or share

I am developing a web+app system and I would like to know if there is any way that Facebook tells me how many likes has an URL I post in a user wall.
What I would like is that when some users hits like, a GET (or POST) Request to my server is called so I can store the external hit in my database without having to update it every time.
Does it even exist?
Maybe FB.Event.Subscribe can help you?
From the docs:
FB.Event.subscribe allows you to define callbacks that will be called
when certain events take place on your site. These events include:
Logging in or logging out via Facebook Login
Someone likes or unlikes a page via an embedded like button
Rendering of social plugins
Comments are added or removed
Someone sending a message to your page or a friend via an embedded send button

Add external file to $_FILES array with javascript/jquery

I have the following case:
I have a third party plugin in my expression engine site that handles my user registrations. It also handles profile picture uploads (which is part of the registration process).
I want to add a feature for grabbing the user profile picture from Facebook during registration. As I don't want to tinker with the third party plugin, I'm looking for a way to solve this on the client side by sending the profile pic from Facebook directly into the php $_FILES array when the registration form is submitted (so the third party plugin can pick it up from there).
Is there anyway to do this?
The answer is: no you cannot. Same origin policy (amongst other things) makes this impossible. The only way to do this is to take information about the user's Facebook account and get it server side using the FB APIs

How to send a request on facebook?

I read the Facebook dev info on how to make a request (located here) but I don't exactly understand what it does. Here's what I'd like to do. I'm using PHP and javascript.
I want a logged in user to send a request to a specific URL (with parameters attached) to multiple Facebook users (users who are already signed up for my site). Also, I need to be able to get the users that they selected and save them in the database, because only those users will have access to the URL that they're being invited to.
Are there any suggestions on how I can accomplish this?
I'm thinking you are talking about the a url request. From my experience this can be done using a simple JQuery request. You can find an example here and you can also read up on java APIs and how to use the methods(Google it). Hope this helps.
The requests dialog is for invitations to Facebook Canvas applications.
You are most likely thinking about the send dialog: https://developers.facebook.com/docs/reference/dialogs/send/
Add a callback function to FB.ui call that saves the id, this will only work if the user ids are hardcoded in. If the user manually adds them, I doubt you can track it.

Facebook php - How can I detect people like my page

For example, I have http://www.example.com/abc.html.
If I like this page, how can I detect me that have already like this page using facebook php api.
Give me help, please
You can collect who likes your page using the newest facebook sdk. What you would do is a sort of work around using their app interface, which is just a LIKE script for your site, and then call https://graph.facebook.com//subscriptions to record the information via mysql or whatever db you are using. I use this method when collecting facebook invites for random contests I hold.
You can use cookies that must be set in the Like button callback or can use Facebook Connect to check whether a user likes your page but this way requires extra permissions and a created facebook app.
Also there is a ready solution for jquery:
http://codecanyon.net/item/like-2-unlock-for-jquery/2822035

How to check user has liked(+1) google+ button on website or url?

How to get like status of google+ button on website or url? I am using PHP.
Unfortunately this isn't quite possible. Neither the REST API nor the PlusOne button itselfs provides a method to check whether a user has +1'd the page or not. Furthermore, if you're using PHP, the user would have to authenticate himself first (using OAuth), so that's probably not what you want, anyway.
What you can do, however, is using Javascript to catch actions of the current visitor. You can specify a callback parameter when creating the +1 button which will be called everytime when the user clicks on the +1 button (source).
While this approach doesn't provide you any information about who the user is (in terms of Google+ user), you could track his actions on your server using a cookie or something else. Or, if that's sufficient, just use the information for the duration of his stay.
if you are trying to get the statistics of your website's +1s, google's webmaster tools will provide the data.
YOu can get this from +1 metric menu in left panel in webmaster tools

Categories