Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i am having a Problem posting a Picture in the Wall of an Event on Facebook. It is Posting

My current Code is:

$post_array = array(
    "access_token" => $facebook->getAccessToken(),
    'source' => "@" . realpath("image.png"),
    'message' => 'Some Message'
);
$post_id = $facebook->api("/".$event_id['id']."/feed", "POST", $post_array);

Everything is working fine, except for the Image: It won't be displayed.

Any Help out there?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
171 views
Welcome To Ask or Share your Answers For Others

1 Answer

If for Events, Try:


//Setup the Facebook object for file upload
$facebook = new Facebook(array(
  'appId'  => 'your_app_id_here',
  'secret' => 'your_secret_here',
  'cookie' => true,
  'fileUpload' => true
));

Then:


$file = "image.png";
//The event information array (timestamps are "Facebook time"...)
$event_info = array(
    "access_token' => 'your access token",    
    "name" => "Event Title",    
    "start_time" => 1290790800,
    "end_time" => 1290799800,
    "location" => "Your Location",
    "description" => "Event Description"
);

$event_info[basename($file)] = '@' . realpath($file);

$result = $facebook->api('me/events','post',$event_info);

Hope it helps


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...