Solved

How to post picture at facebook news feed

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article discusses how to implement server side field validation and display customized error messages to the client.
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 how to look for a specific file type in a local or remote server directory using PHP.

696 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