Automatic posts on facebook

Asked

Viewed 1,963 times

5

I have a system where I use the cURL to login to a site. On this site I have a button to share facebook content, I want to do it automatically. That is, end the user’s work by logging into the site, and sharing the content. What way can I do this? Using the API facebook? Can anyone give me some direction?

EDIT: I guess I wasn’t clear on my question, I don’t 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, only for that the user would have to be logged in right? My trouble is there.

  • Better define what your system is like and what would you like to do? The "click with Curl" part is not very clear. This other site that has the share button is yours or someone else’s?

  • I’ll try to describe it better, the site is someone else’s, every day I have to log on to this site, log in and password to it, and then click on a share button that’s there, and share the content within a group that I have on facebook. What I wanted the system to do was make it all automatic, with Curl, without me having to log in, click, share, you know? I just ran the script and it did everything.

  • Do you necessarily need to use Curl? This sounds more like your automation task. If you can use other tools you can try using Autoit or Autohotkey which server to automate these desktop tasks of yours. Or Selenium, which will automate this task for you to click the share button. There is even a bind to Selenium using PHP here -> http://docs.seleniumhq.org/download/

  • It does not necessarily have to be with Curl, but I want to make a system that is not restricted to me, after I can do it for myself, I want to be able to do it for several people by storing their data (with clear concretion). After all I want when I run the script, one by one the system enters, shares, exits, enters, shares and exits. But I’ll take a look at Lenium, thanks.

1 answer

4


Before anything you need to create a key for your app Here.

Then go to the Apps tab, Create New App

Aba Apps

After the app created you can catch the APP ID here:

inserir a descrição da imagem aqui

After that, you can use the share button on each of the contents like this.

In the HTML:

<div class="fb-share-button" data-href="/questions/10272/postagens-automaticas-no-facebook" data-type="button_count"></div>

In the 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'));

In place of XXXXXXXXXXX you must put the key to your app.

You can use the cURL as indicated here But I believe it’s much simpler to use the PHP for this task, because you will need the access token, achieved only after logging in with your app on API of Facebook.

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

The steps to the creation of APP ID are the same

  • If possible look what I edited in my question, your answer ta great but it’s not what I need.

  • @Leonardo Otto and for me to post on another Timeline ? example: ask authorization for a user and post automatically on his Timeline ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.