facebook api: remove the "shared a link" when posting via api - facebook

I think there is a trick to remove the "shared a link" next the username when you post something via the facebook api. I notice it's removed when you add a message field to your post, but I would like to get it even without any message. I tried to pass TRUE, a blankspace, "&nbsp", etc as message but that was like there was no any message.
array(
'message' => " ", // I guess the trick is somewhere here
'link' => $link,
'name' => $name,
'description' => ' ',
'caption' => $date,
)
what I would like:
what I get:
with a message:

Related

Embedding like page action with post on Facebook

When we post a feed on Facebook using Graph API, a parameter is passed called "Action" in which we need to pass an array of actions which contains name of action and link.
$feed=array(
'message' => "Trial fb post",
'name' => "trial",
'caption' => "Trial caption",
'actions' => array(
array(
'name' => 'Give it a try',
'link' => 'http://www.blinkpot.com/'
)
)
);
I saw some posts having like this page option by which users can like the respective page.
How can I attach that action with my post.

Using the Graph API Explorer tool, how to specify complex parameters in HTTP Post?

Using the Graph API Explorer (https://developers.facebook.com/tools/explorer) how do you specify any of the parameters that are an object rather than just a string value when you click "add a field"? Things like arrays of objects such as actions field of the post (https://developers.facebook.com/docs/reference/api/post/)
it is a json object.
for example from this answer
$attachment = array('message' => 'this is my message',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'http://mylink.com',
'description' => 'this is a description',
'picture' => 'http://mysite.com/pic.gif',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
);
$result = $facebook->api('/me/feed/',
'post',
$attachment);
your actions field in Graph API Explorer is
[{"name":"Get Search","link":"http:\/\/www.google.com"}]

how to set the height of the swf file posted to facebook feed

How do I set the height of the swf file posted to facebook feed using the PHP API.
Here is my code. It is working fine but I cant find a parameter to set the height.It height is automatically set to 259px. I tried the extended_height parameter also but no luck. Do I have to use the REST API?
$options = array(
'access_token' => $facebook->getAccessToken(),
'link' => 'http://www.example.com/',
'name' => 'Test App',
'caption' => "Created using my test app",
'picture' => $apppath.'Icon.jpg',
'source' => $apppath.'main.swf',
'description' => "Description field",
'actions' => array( 'name' => 'Click me', 'link' => 'http://www.google.com' )
);
$wallPost = $facebook->api('/'.$friendid.'/feed', 'post', $options);
Anybody got a solution ?
Have you checked this ? https://developers.facebook.com/docs/guides/attachments/
it shows how attachments are made. Plus if you want you can even use open graph tags in your page to show the media once your page is shared via FB

Posting Attachment Facebook Graph API

Right now I'm trying to figure out how to post an attachment using facebooks graph api.
Right now I'm using
$attachment = array(
'message' => $_POST['tt'],
'text' => 'Download',
'name' => 'name',
'href' => 'http://www.url.com',
'description' => ' description!',
'media' => array(array(
'type' => 'mp3',
'src' => $url,
'href' => 'http://www.url.com/',
'title' => $title,
'artist'=> 'artist',
'album'=> 'the album')));
$statusUpdate = $facebook->api('/me/feed', 'post', $attachment);
Problem is it's only posting the message, nothing else, no attachment or anything.
Does anyone have any idea why?
Thanks
Attachments aren't yet supported by the Graph API.
Per the documentation
Arguments message, picture, link,
name, caption, description, source
See my answer in your other question for a workaround.
You have to use the old php SDK until graph supports attachments... Graph only supports photoupload.
Im mixing Graph and old SDK without problems..

Send notification or post on wall

i have been going crazy and cant figure out how to make a script for my application that would allow the user to select a friend and send them a notification or post on their wall from my application.
I just need to notify their friend that they have been challenged to play a flash games, just a simple text with a link, i dont need anything fancy :D
Here is what i tried and it doesnt work :( no idea why.
$message = 'Watch this video!';
$attachment = array( 'name' => 'ninja cat', 'href' => 'http://www.youtube.com/watch?v=muLIPWjks_M', 'caption' => '{*actor*} uploaded a video to www.youtube.com', 'description' => 'a sneaky cat', 'properties' => array('category' => array( 'text' => 'pets', 'href' => 'http://www.youtube.com/browse?s=mp&t=t&c=15'), 'ratings' => '5 stars'), 'media' => array(array('type' => 'flash', 'swfsrc' => 'http://www.youtube.com/v/fzzjgBAaWZw&hl=en&fs=1', 'imgsrc' => 'http://img.youtube.com/vi/muLIPWjks_M/default.jpg?h=100&w=200&sigh=__wsYqEz4uZUOvBIb8g-wljxpfc3Q=', 'width' => '100', 'height' => '80', 'expanded_width' => '160', 'expanded_height' => '120')));
$action_links = array( array('text' => 'Upload a video', 'href' => 'http://www.youtube.com/my_videos_upload'));
$target_id = $user;
$facebook->api_client->stream_publish($message, $attachment, $action_links, $target_id);
UPDATE:
appinclude.php
$facebook->redirect('https://graph.facebook.com/oauth/authorize?client_id=132611566776827&redirect_uri=https://apps.facebook.com/gamesorbiter/&scope=publish_stream');
Error i get:
{
"error": {
"type": "OAuthException",
"message": "Invalid redirect_uri: The Facebook Connect cross-domain receiver URL (https://apps.facebook.com/gamesorbiter/) must be in the same domain or be in a subdomain of an application's base domain (gamesorbiter.com). You can configure the base domain in the application's settings."
}
}
Without the extra "s"(http) i get this error:
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
Please if you could post an example.
Also do i need extended permission to do that or if the user sends the message i dont need that ?
Thank You
Also do i need extended permission to
do that or if the user sends the
message i dont that ?
Yes, you need the offline_access and publish_stream extended permission from the users.
Update:
In your appinclude.php file, put code like this:
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();
$facebook->redirect('https://graph.facebook.com/oauth/authorize?
client_id=[YOUR APP ID]&
redirect_uri=[YOUR APP URL]&
scope=publish_stream, offline_access');
Replace [YOUR APP ID] with application id that you can see from application settings where you created the site in Facebook Developers section. Also replace the [YOUR APP URL] with your app url.