Reputation: 21
I havent use FBML and PHP SDK for a while and i just can get wallpost work anymore? Last year my code works for fine but now it wont work... so how my app can wallpost again? Help :)
Old code:
<?php
require_once('fb/src/facebook.php');
$config = array(
'appId' => '******',
'secret' => '***********',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
$tiedosto = file("http://mydomain.com/doh.txt");
$sids = $tiedosto[$total];
$tiditii = "What's here:";
$message = "";
$text = "Checkout!";
$attachment = array('name' => "$tiditii", 'href' => 'http://mydomain.com/do',
'description' => "$sids
", 'media' => array(array('type' => 'image', 'src' => 'http://mydomain.com/pic.gif',
'href' => 'http://mydomain.com/do')));
?>
<script>
function callback_function(){document.setLocation("http://apps.facebook.com/myapp");};
function publishPost() {
var msg = <?= json_encode($message) ?>;
var attachment = <?= json_encode($attachment) ?>;
Facebook.streamPublish(msg, attachment);
}
</script><p>
<input name="Next" type="button" id="button" class="appMY_APP_ID_button" value="Publish" onclick="publishPost(); return false;"/>
Upvotes: 1
Views: 722
Reputation: 143
I don't know much about php.. but why don't you use FB's java script sdk. It's easy to use. https://developers.facebook.com/docs/reference/javascript/
Upvotes: 0
Reputation: 10586
Try something like this using the graph API
$attachment = array(
'access_token' => $access_token,
'message' => "Hello, here is a post",
'name' => "",
'link' => "http://www......",
'description' => "Write here your description",
'picture'=> "http://www.yourserver.com/images/test.jpg";
);
//print_r($attachment);
$facebook->api('/me/feed', 'POST', $attachment);
Facebook PHP SDK can be found here
Upvotes: 1