is it possible to write an automated script that uploads a specific video to a specific facebook page without any user action, like login verification and "Do you want to allow App XY to post something on your wall"?
I looked a bit into the Facebook PHP SDK, and there are a couple of things I dont like:
1) You always have to verify that you want to post something on your page
2) It seems it can't be run from localhost, you need a server. That would make the whole thing slower as I had to upload a video to a server before uploading it to facebook.
Another question: Is it possible to "save" the facebook logins, so i can switch pages? Otherwise I just would use multiple .php files.
As #CBroe said, your question looks quite broad. But anyway, have a look at my answer here Obtaining a Facebook auth token for a command-line (desktop) application to get an idea how this can be solved.
Related
I'm working on integrating the Facebook PHP SDK into a website I am building, and I have a question (maybe a problem, not sure yet...).
Initially I was planning on setting all the permissions in the initial login to allow my users to post to their feeds/page feeds through my site depending on which route they prefer, BUT I read on the FB SDK pages that requiring permissions at initial login that are not essential at that moment is bad practice.
My question is how do you add more permissions later using the PHP SDK? I scoured the internet for two days now looking for an example, and haven't been able to find one. Maybe I am looking in the wrong places. I don't know. I just haven't had any luck.
My thought is that you check if the permission is set, and if not, log the user in with that permission, and use the new access token. The issue for me is that doing it this way, I will have to write the form data to the session, then call it back when the FB login sequence is done.
Is my thinking correct, or is there a way to do this better? Should I just stack all the permissions right off the bat, or should I do it the way Facebook suggests?
The whole reason that my site is using facebook is to allow users to automatically share their posts (it is an art site) when they upload a piece to the site, instead of uploading a piece then having to go to that piece and click a share button on the page.
Hopefully this rambling makes sense!
My question is how do you add more permissions later using the PHP SDK?
Same way, as you asked for the initial permissions:
By calling the login dialog again, with those additional permissions in the scope.
I searched in Stack Overflow, Google, etc, but I can't figure out how to show my stuff from my Facebook on my website. I tried some solutions and each one prompted the login dialog and visitors had to log in and accept my application (I've created one to test).
Many answers here were too generic, I didn't understand them that is why I'm asking.
I want something that would let my website "log in" to Facebook and show my status or photos to visitors without them needing to accept an app or log in into Facebook with their account.
I tried a facebook-php-sdk example with my AppID and AppSecret and it asked me to log in.
Also, github.com/facebook doesn't have an SDK for Python similar to facebook-php-sdk
You could write a script (eg. using the FB PHP SDK) that uses a long-lived access token to fetch your FB data and then store the data in your backend database (or other store for your website). To Facebook, your script will look like an app and your machine will be the only 'user' of that app. Note, long-lived access tokens are good for 60 days max. You could also try using an App Access Token to fetch basic info. App Access Tokens don't expire.
This might not be exactly what you are looking for since you posted this with the php and python tag, but it might solve your problem.
If you're website is powered by the wordpress engine you can use If-this-then-that : https://ifttt.com/
It basically allows you to create "recipes" with something like:
if new status on Facebook then create post on wordpress
The post will not require others to log in to Facebook.
This is without writing a single line of code only a couple of mouse clicks. So I'm not sure if this satisfies your needs.
I'm a little bit confused right now. But I think I'm making it more complicated than it is actually :) It's about posting out of a Facebook app. I have a Facebook page and I'm about to develop an app which should be integrated in that page. The purpose is to make the page more attractive and memorable. The app is about the content the page contributes. The problem is (I've alredy read some questions about that, but still I don't get it), if I post on a users' wall, I post as the app and not as the page.
It is possible to post on a users' wall after requesting their permission (publish_stream) and also on to post on a page the user administrates (manage_page). Am I right so far? But is there a way to post as my page within my app? Can I post as a one of my app users on a wall with any permission? I thought about if I start to use my app as my page, maybe then I can post as my page?
It may sound a bit awkward, but I hope anyone can help me. At least to tell me that I'm dreaming of something which wouldn't be possible anytime (because of security issues i.e.).
Thanks!
You cannot post as your page, users in your application can post to their walls or your applications page. In fact when building your app, if you are using Facebook as a page and try to refresh your App from your URL you will get errors... if you need help starting your app with the functions i have mentioned, visit this link: http://www.epixseo.com/index.php/facebook-php-3-3-1-and-javascript-sdk-graph-api-tutorial/
I have a Facebook application used as a tab in a fan page, that displays different information depending on whether tha user is a fan of that page or not.
Now I've been asked to have it post a message to a user's wall if they perform certain action (follow a link or whatever), and so far I haven't found a way to do that. All the documentation I have found refers to stand alone apps, and I've even seen it suggested (in the FB forums) that you can't get the auth token from an app.
So, i still think it can be done, but how?
If a user has authorized your app, you can post to her wall using the PHP SDK. See the PHP SDK api documentation for examples.
All apps have to be iframe apps now, so loading the JS sdk should be fine.
You have to get permissions first ->
http://developers.facebook.com/docs/authentication/#applogin
Then you can post using php with what Dhiren said, or, post with the fb.api function with JS ->
http://developers.facebook.com/docs/reference/javascript/FB.api/
Let me know if you need an example script.
Cheers
I'm developing this Facebook Application and I was wondering if it's possible (and how) to programmatically, through the Facebook PHP Graph API, press some 'Like' button on some page?
Of course, this is optional on my application... I'm still not ready to really explain what application I'm doing, but it would be interesting to code such a feature.
Is it possible somehow?
By your description it sounds like you're trying to get a user to like something without the users knowingly clicking a like-button. This sort of interaction is not condoned by Facebook, I think. There are various black-hatty ways to accomplish this though, one fairly elaborate one is descriped here: http://www.liquidrhymes.com/2010/08/25/smoking-hot-bartender-is-some-smoking-hot-facebook-spam/
UPDATE Sorry, I might be wrong. If you get stream_publish extended permissions from the user, you might be able to like posts on their behalf by doing a POST to /POST_ID/likes. See Publishing to Facebook in http://developers.facebook.com/docs/api
You cannot do this. Facebok wont let you do a POST to /POST_ID/likes, you can only do a get request to retrieve their likes. What you are trying to do is a violation of facebook's TOS. I would suggest just adding a like button and "forcing" them to like before they continue with your application. However, in my opinion even that is kind of silly because they can instantly go unlike it after they have used your application.
i was looking for the same thing, but not to force a user into liking something, but actually for their own protection.
here is where i come from: on a web site (maybe on multiple pages) there is an "I Like" button, implemented as described by facebook.
each time a user goes to that page, the browser will make a request to facebook, throught the iframe that contains the button, providing all the info that we are used to from a web server log file.
if the user has in the past logged in facebook and not cleared the cache. the request will also contain the cookie indentifying the facebook user.
so even more then analytics, facebook know all about the user activity on those pages.
so i wanted the user to only give this info when they decide to.
my solution was to have a button (as graphic only) on the page. when the user clicks it a new frame should open and only there the facebook code should be executed.
obviously on the new frame i could not put the normal "i like" code, since that would require a 2nd click for the user. at this point i would need the "programmatically clicking of the i like button".
it is not an opengraph solution, but it works: the frame just does a redirect to
http://www.facebook.com/share.php?u=URL