Posting Twitter/Facebook-Status without authenticating? - php

I'm currently working my way through the facebook-iphone-sdk and the MGTwitterEngine and I'm wondering why this all has to be so hard.
I'm not planning to access any data from the two social networks, just allow the users of my app to post a message as their status/update.
Now after I installed the facebook-iphone-sdk I realized they just send you to safari to authenticate at facebook and then back into your app.
Now this seems overly complicated for the users of my app, if they just want to post they don't have to go back.
Isn't there a way, I could just call something like
http://api.twitter.com/version/statuses/update?text="this is the new status text"
?
EDIT:
The first answer
http://twitter.com/home?status=[URL ENCODED TWEET].
is exactly what I need.
Unfortunately this works perfectly on the Laptop, though if you are not already logged in on the iPhone, you will be presented with a a screen where one has to press "login" once. (at the url "mobile.twitter.com/home?status=[]").
Pressing login there links you to "mobile.twitter.com/session/new" without the status argument and so once you are authenticated the status message is lost.

The URL you're looking for is:
http://twitter.com/home?status=[URL ENCODED TWEET].
This will open up a window of twitter and, if logged in, populate that tweet into the Tweet box.
For Facebook Share, the URL is
http://www.facebook.com/share.php?u=http://SHAREURLGOESHERE

There is lots of sample code that comes with the facebook-iphone-SDK. If you were to allow the user to pubish without authorizing it chances are apple would deny it.

Related

Facebook click-id missing (fbclid)

I am currently running several ads on facebook and I have just started using the facebook-click-id to replace facebook-pixels for the tracking. For some reason I have found that there are a lot of clicks coming in through the ads without the fbclid-parameter attached to the url as a get-parameter.
Through a google search I have found out that the only reasons the fbclid-parameter would not be attached to the url would be that the user clicking on the ad is not logged in to facebook or that the user is using his/her browser with the incognito-mode activated.
It seems odd to me that so many clicks could happen under those circumstances. Which is why I am wondering if there are other reasons why the facebook-click-id (fbclid-parameter) would not be attached to the url.
Are there any other reasons why the fbclid-parameter would not be attached to the outgoing url of a facebook ad? Thanks!
after doing some tests trying to solve the same problem, what I noticed is that fbclid parameter did not appear in outbound links when using the browser built into the mobile Facebook app.
So, I think that this is a Facebook limitation.
Hope it helps,

Posting on Facebook Page on user's behalf

A team of some friends and I have come up with an app/product idea that we have been working on. I have to be vague on exactly what the details are, but hopefully I can explain it well enough to have the questions we have answered.
First, we have a web server with a database - we have developed all of the code for that in PHP. Each user will have a device which when an action is performed on the device, it sends a message to our server, and the PHP code on our server handles the message and stores the sent data in the appropriate fields in our database.
We want to run this through Facebook - we have an app and a Facebook page created for this. The idea is that when a user performs an action on his or her device and the message is sent to the server, the PHP code will automatically make a post on the Facebook page on the user’s behalf (not on the Page’s behalf).
Between all of us on working on this project, we have spent many days and many hours trying to figure out how to make the automatic post to the page. It’s extremely difficult googling this topic since all of the various examples are using different versions of the Facebook SDK (we are using the latest). There are lots of somewhat similar type questions/examples, but we can't find one that answers specifically what we are asking. In fact, we aren’t even sure that anybody but an ‘admin’ can post on a Facebook page with the new SDK, any longer. I do see this link in the Facebook developer section, https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed, where it says under the Publishing section:
Permissions
A user access token with publish_actions permission can be used to publish new posts on behalf of that person. Posts will appear in the voice of the user.
So, it sounds as if a user can post to the Facebook page if it is given an access token with publish_actions permission, yet we can’t find any example of code of this actually being done. Could anybody explain how to do the automatic posting to the page on a user’s behalf (hopefully, using PHP, since that is the language we are using on the server side), or at least point us to a good example? We are all experienced developers, but this is the first time any of us has done anything with Facebook development. So we certainly aren’t amateurs, but with Facebook development, we are. We may be overlooking something obvious, but after seeing so many links, my mind is jello.
A summary of our questions:
1. Can it even be done with the latest Facebook SDK that a post can be made to a Facebook Page for our product on the user’s behalf? (to be clear, we are talking about the Facebook Page we created for our app, not a user's page)
2. If so, what specific permissions do we need to give the user, just the publish_actions one? We don’t want to give the user too much permission to be able to screw up our page, of course.
3. Can this be done automatically with PHP from the server?
Any help would be GREATLY appreciated!

Facebook, check if user is a fan and logged in using PHP

I have searched the Internet and SO for over a week, but have not managed to find anything yet so allow me to ask a question which has already been asked loads of time on SO, but for which none of the answers seem to be working for me.
I have a website and a Facebook page. On my website I have the usual Facebook "Like me" box. As I want to show some extra content to my fans when they visit the website - and encourage non-fans to become a fan - I would like to know if it is possible, via PHP, to:
1. Understand if the user is a fan
2. Understand if the user is logged into Facebook
What I would like to be able to do is send a PHP request to Facebook and receive one of the following three answers: "is a fan", "not a fan", "not logged-in/not a Facebook user".
In the first case I would show the fan-only content, in the secon case I would try to encourage the user to become a fan, while in the third case I would not do anything as I'm not sure the user is a Facebook user.
Please note:
1. I do not need any further identifying information
2. There is no app involved here, as users are fans of my page, although I could build one if necessary
Some answers on SO seem to point to this tutorial, but as my page is not an app, I cannot really use this solution:
http://www.masteringapi.com/tutorials/facebook-api-check-if-a-user-is-fan-of-a-facebook-page/20/
Unfortunately Facebook's APIs won't tell you if the user's logged in or if is a fan of your page until you make the user install your Facebook app (and for the likes you will need user_likes permission too).
The only kind of exception is that when you are running a page tab. At the time facebook embeds your content via an <iframe>, the signed_request POST parameter that comes with it will tell you if the user is a fan or not. You can read about the signed request's here..

Posting to User's walls as application using Facebook PHP API

I've been building a web app that uses facebook integration for easier registration/login and notifications for the users. However, for the notifications I want to be able to post to a users facebook wall when something happens on our site.
Really I see two possible problems with doing this. First being that the user will most likely not be logged in to our website when the notification needs to happen. Second I have not found a way to post to the feed using any identity other than the current logged in user.
So to reiterate exactly what I'm trying to do. When some action takes place on my site involving Bob, I want the websites application to post on Bobs wall notifying him of the action as if the application is one of Bobs friends. From some of the things I've seen while researching this, it seems as if facebook might not treat applications like users and I might have to go through a page to accomplish what I want. But really I'm ok with that.
What you need to do is to ask for the offline_access permission. Then you can store their graph id property after they login/authorize to your site's database. Then you just post to that graph id instead of instead of /me. In your case you would then POST a request to the "$user_graph_id/feed" endpoint with whatever parameters you usually have.

How to programmatically "press" a 'Like' button through a Facebook Application?

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

Categories