'Link sharing on facebook using graph api(PHP Code)

I have created a facebook application for sending messages.I am posting some content and image to my wall using php facebook feed code.Normally when i post something on my wall it will visible on my friends news feed.But my wall post is not visible on my friends news feed. The code for posting wall is

$attachment = array(
    'access_token' => $AccessToken,
    'message' => "$Msg",
    'name' => 'some content',
    'link' => $link,
    'picture' => "$ShareImage",
    'description' => '',
    'caption'=>'',
);

So i remove the hole content and rebuild the code like this

$AccessToken       = $this->facebook->getAccessToken();
        $attachment = array(
        'access_token' => $AccessToken,
        'message' => 'http://www.mysutec.com/stie/test',
        );
        $send = $this->facebook->api("/".$fbid."/feed", 'POST', $attachment);

Then also the the content is not showing on friends wall.But in facebook developer document they mention link sharing

http://developers.facebook.com/docs/reference/api/link/

How i can implement this using graph api(php)



Solution 1:[1]

You need to issue POST request to Graph API to post/create content.

$params = array(
  'link' => 'www.example.com',
  'message' => 'Posting with the PHP SDK!'
);
$response = $facebook->api('/me/feed', 'POST', $params);
echo 'Post ID: ' . $response['id'];

You also does't need to explicitly pass access_token in your case since PHP-SDK will use one for current user automatically.

You should read PHP-SDK documentation for Facebook::api method which have posting of link as one of the samples.

Solution 2:[2]

Why ask this question twice? i answered it on your other thread : Another method for sharing link on facebook wall using Graph API

posting via /me/feed gives you message a lower ranking then posting an image/link .. this is why you sometimes won't see it on your friends news feed...

Cheers!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Juicy Scripter
Solution 2 Miguel Alejandro Fuentes Lopez