Automatic Facebook postings

5

I have a system where I use cURL to log in to a site. In this site I have a button to share facebook content, I want to do this automatically. That is, stop the work of the user entering the site, and share the content. How can I do this? Using API of facebook? Can someone give me some direction?

EDIT: I think I was not clear on my question, I do not want to create the share button, it's already created, I just want to be able to click it with cURL, and share the content, would have to be logged in right? My difficulty is there.

    
asked by anonymous 23.03.2014 / 20:48

1 answer

4

First of all, you need to create a key for your application Here .

Then go to Aba Apps, Create New App

AftertheapplicationyoucreatedyoucangetAPPIDhere:

After that, you can use the share button on each of the content as well.

No HTML :

<div class="fb-share-button" data-href="http://pt.stackoverflow.com/questions/10272/postagens-automaticas-no-facebook" data-type="button_count"></div>

No Javascript :

(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=XXXXXXXXXXXXXX";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

Instead of XXXXXXXXXXXXXX you should place the key of your application.

You can use cURL as indicated here But I think it's much simpler to use PHP for this task, because you'll need the access_token of access, achieved only after logging in with your application in API of Facebook .

To automate using PHP you should use the Facebook API, using SDK in PHP . Here has the link to the SDK And here has an example of how to post using PHP and API of Facebook

The steps for creating APP ID are the same

    
24.03.2014 / 03:18