How do you publish a picture to an event with facebook opengraph? - facebook

I am able to successfully publish an event to facebook but am unable to include a picture. It looks like this needs to be done via a "connection" in open graph but I can't seem to find a clear example on how to do this.

Yeah, the picture connection appears to be read-only. However it wouldn't hurt to try sending an HTTP Post to /{event id}/picture and seeing if it's just an omission in their API documentation. My guess is that it is not available.

Related

How to make a comment in facebook with attached picture

In facebook site you able to make a comment and attach image to it. Is it possible to do the same things with facebook api?
I have read this facebook for dev link and there is no answer to my question.
If you read the documentation properly, it says-
message is the only parameter in this API call. It should be a string containing the comment text.
So, using the API you can just comment a message to the object using-
POST /{object-id}/comments?
message='This is my message'
, no link/picture could be attached alongwith.
I don't know if it is a recent change in the way Facebook handles this, but if I put the complete url in the comment, Facebook detects it as an image and shows it there (along with the url).
Maybe it's not the cleanest way, but it's a way.

(#100) link URL is not properly formatted when posting to a facebook page

I am trying to post a URL to a facebook page. using PHP SDK.
I am able to post successfully from my localhost. But on the live server, I get the result "Sorry, something went wrong".
when running the code from live server, I have no problem obtaining access_token to post to the page.
Only the posting will not work.
I tried to post the link manually using the graph api explorer. and found that
I am ABLE to post a message successfully via the graph api explorer.
I am NOT able to post a URL via the graph api explorer. I get the error
"(#100) link URL is not properly formatted"
I do encode the link that i am trying to post. and they are valid, existing links.
I even tried using http%3A%2F%2Fgoogle.com , and it would return the same error.
Some Other information
The code is executed from mydomainname.com/folder/
I have added the domain name to "App Domains" field.
Sandbox Mode is On.
When I tested from my local, I was able to post 25 links to the
page.[after which it was giving errors]. When things were not
working at the live server, I came back to locahost to again test
with 25 links and more and found things to be working fine from
localhost. I wonder if I hit some limit or my application has been
black listed.
Anyone has got any ideas?
Thanks
UPDATE
I took the URL that was used by the live server (to post link to the facebook page) , and used fiddler to post it from my local machine. and it worked.
so i am wondering whats preventing the code from working successfully from the server?
I tried the same code from another domain and it worked.
I am yet to find out if it was not working because of the way the 1st domain was sending CURL requests, or if the domain was blacklisted for posting too much in the past.
either way, facebooks error messages are not at all helpful!
If you're using your own wall, notice the difference between:
"me/feed" and "me/photos" url. The first one doesn't work!!!
I also tried the same thing but unfortunately it works for online images but not for local ones. i.e
'picture' => class_exists('CurlFile', false) ?
new CURLFile($photo, 'image/jpg') : "#{$photo}",
will not work, but
'picture' => "http://i.stack.imgur.com/VGWZD.jpg?s=24&g=1",
will work
I also had some problems with this. Weirdly enough it only worked when I sent the url to the picture without any URL encoding via the POST request to the Graph API.
Try the link without the quotation marks "". I was stuck as you but not any more without the quotation marks.

Open Graph calls generating OAuth Exception

I'm experiencing some problems getting an Open Graph implementation working.
As far as I can tell, I have the correct meta tags present. When I paste an URL into the Open Graph Debugger, it returns with the proper information defined (title, description, image, etc), and no errors.
I have version 3.1.1 of the Facebook PHP SDK.
I have Open Graph enabled for my development app, and I have an action (read), and an object (article) defined.
The implementation in question is a website, not a facebook application. On facebook, the app's "category" is "other". I followed some advice in another thread, and changed it to "Game", which did not work, so I have changed it back.
I authenticate my web app user with facebook and receive a code, which I then trade in for an access_token, pretty standard. I ask for the following permissions:
publish_stream
publish_actions
offline_access
However, when I attempt to make a call to publish an action, I receive an OAuthException, and have no real way of debugging it.
Some oddities:
The graph API doesn't seem to like the URL format specified in the documentation: me/[app_namespace]:[action_type]. In my case, this would be me/' . FB_APP_NAMESPACE . ':read, where FB_APP_NAMESPACE is defined earlier to be a namespace as defined in the facebook application settings. Both the API and the Graph API Explorer throw an error stating that it doesn't understand the action given. It seems to be trying to read the namespace as the action.
If I remove the namespace from the url, it reports that the passed in action doesn't match the og:type defined in the url, since the og:type in the url contains the same namespace I removed.
If I remove that namespace from the meta tag, and try again, I get a generic OAuthException that I can't debug.
When I look at the code sample provided in my facebook app, the action seems to be news.reads instead of just read.
If I use that action, the graph API returns an error saying that my ID is unauthorized to use the open graph, as it is not an admin, dev, or tester for my application. Unfortunately, I am the app creator, which means either the graph API is lying, or I am lying to myself!
I think the solution is pretty simple - perhaps I have forgotten something, or selected a certain category incorrect. Either way, this is a little frustrating, to say the least!
Apparently, facebook's default read call isn't available to use if your application/action isn't submitted.
I ended up creating my own read action, and it worked on the first try. Go figure.
For predefined actions the post url's are slightly different, you will have to use something like this:
POST https://graph.facebook.com/me/news.reads?article=[article object URL]
See: https://developers.facebook.com/docs/opengraph/actions/builtin/#read

Getting facebook profile picture

i need to get the facebook profile picture of anyone by passing their id. But i no need to use facebook API or Graph anything else.. Just i need to give the url with that id.. Is it possible to get the profile picture in this way? I tried in google but i didnt get it. If anyone knows this please respond me...
Well, I think the only options available are:
https://graph.facebook.com/[PROFILE_ID]/picture (You can include this URL inside a tag and it will work).
Scrap yourself the page corresponding to the profile, i.e. http://www.facebook.com/profile.php?id=[PROFILE_ID] and get the URL of the picture there.
I would suggest you to use the first one, because it gives you more flexibility about the picture size (?type=small, ?type=thumbnail, etc).
Edit
Keep in mind that this answer is from 2011, and Facebook makes changes in its APIs frequently.
Apart from using Graph API as already mentioned above (https://graph.facebook.com/[PROFILE_ID]/picture), there are a couple more ways:
FlipTop has a service that pulls up all sorts of information on Facebook users, including direct CDN URLs (e.g. https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/275588_504804917_147319_n.jpg) of profile pictures. (Link to API documentation)
Cloudinary has a similar service, but with hosting thrown in the mix. They do require you to open an account, but it's free. Then you can use their CDN URL format to link to any picture like this: http://res.cloudinary.com/[YOUR_ACCOUNT]/image/facebook/[PROFILE_ID].jpg (Read more here)

Facebook Post-Remove URL not called when app removed

I'm testing the post-remove URL call that should be pinged via POST when my Facebook application is removed, but it doesn't seem to be called.
Monitoring the network traffic in firebug and looking at the POST made when removing the app, the POST does not directly call the Post-Remove URL I specified in the app settings, nor does it pass the POST variables I expected per the documentation.
I set up a simple output at the URL specified "remove page called" that I'd expect to see as the response but don't.
Lastly, the URL called should remove database items which do not get removed.
I don't have any evidence that my post-remove URL is getting called at all. It seems I'm not the only one having this issue but not much insight has been provided.
Answer posted by folks on the Facebook Devleoper forums