Solved

How to post picture at facebook news feed

Posted on 2010-11-23
4
557 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now