Solved

How to post picture at facebook news feed

Posted on 2010-11-23
4
562 Views
Last Modified: 2012-05-10
Hello Sir

I want to upload any file at facebook news feed option.Means when i upload any file at server from my website that time it shall also upload at facebook news feed section.Then please guide to me how to do this.
Regards,
Aasim afridi
0
Comment
Question by:rAfridi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:roynaufal
ID: 34203369
check the fb development references:
u need the php sdk
https://github.com/facebook/php-sdk/

u need to create an application inside ur fb account

then use this javascript code , assuming u have already connected to facebook:

 public function postToWall($id, $message, $picture, $link, $name, $description) {
        try {
           $fb=new Facebook();
            $result = $fb->api("/$id/feed", "POST", Array(
                        'message' => $message,
                        'picture' => $picture,
                        'link' => $link,
                        'name' => "your app name",
                        'description' => $description
                    ));
            return true;
        } catch (FacebookApiException $e) {
            return false;
        }
    }
0
 

Accepted Solution

by:
rAfridi earned 0 total points
ID: 34203812
Dear sir,
Thanks for very soon reply
But i am facing one problem  when i am running this code it is giving "Permission denied error " .
I am tiring to  extend the permission but it is not taking .I am using this code to extends the permission


$uid = $facebook->getUser();

$api_call = array(
                  'method' => 'users.hasAppPermission',
                  'uid' => $uid,
                          'ext_perm' => 'publish_stream '
            );
            
            $can_post = $facebook->api($api_call);


Regards ,
Aasim Afridi
0
 
LVL 3

Expert Comment

by:roynaufal
ID: 34203841
did you first implement the 'connect with facebook' feature ?
where you can login to the site using facebook, it's a button you click, then a window from facebook opens up where you enter your facebook username/password afterwhich you allow your application to access your facebook info
0
 

Author Closing Comment

by:rAfridi
ID: 34459396
Best
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question