Post on a logged in users facebook wall
Posted
by Matt Nathanson
on Stack Overflow
See other posts from Stack Overflow
or by Matt Nathanson
Published on 2010-05-06T22:53:51Z
Indexed on
2010/05/06
22:58 UTC
Read the original article
Hit count: 561
Hey all, I've created a widget that will essentially unlock a music track, providing you post to either your twitter account, or facebook wall.
I've signed up through facebook connect and I am able to successfully post onto my own wall... but the functionality I'm looking for is to be able to take ones username and password and automatically log in to facebook, and send my desired message. Like I said, it posts on my wall successfully, it's just not using the username and password from the field to log in to their respective facebooks and post.
<?php
$facename = $_POST['facename'];
$facepass = $_POST['facepass'];
define('FB_APIKEY', 'my_api_key');
define('FB_SECRET', 'my_secret_phrase_');
define('FB_SESSION', 'my_session_id');
require_once('facebook.php');
echo "post on wall";
try {
$facebook = new Facebook(FB_APIKEY, FB_SECRET);
$facebook->api_client->session_key = FB_SESSION;
$fetch = array('friends' =>
array('pattern' => '.*',
'query' => "select uid2 from friend where uid1={$facename}"));
echo $facebook->api_client->admin_setAppProperties(array('preload_fql' => json_encode($fetch)));
$message = 'I downloaded Automatic Loveletter\'s new single \'To Die For\' here!';
if( $facebook->api_client->stream_publish($message))
echo "Added on FB Wall";
} catch(Exception $e) {
echo $e . "<br />";
}
?>
Any help in the right direction is greatly appreciated! Thanks, Matt
© Stack Overflow or respective owner