I am an admin of Facebook fan page where i need to post an image as admin. While i use this code it takes posts in my own Facebook wall. I have the manage permission for the app. Any idea?
<?php
$album_id ='9543045';
$access_token='W4997qoxbdFGLZA1d8a7JhoNoKxZBcNdFcdUXgDXa7k7oeFvKBIZA6OHf81pZAyV5nCAZD';
$file= '/Users/bazinga/Desktop/banner1.png';
$args = array(
'message' => urlencode('Hello'),
'description' => urlencode('World'),
'access_token' => urlencode($access_token)
);
$args[basename($file)] = '@' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$access_token;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
//returns the photo id
print_r(json_decode($data,true));