Bagaimana untuk memasukkan status di Facebook menggunakan PHP?

Cara 1 :

Ketik di adress bar :

https://graph.facebook.com/[facebook id]/feed?name=[judul pesan]&message=[isi pesan]&link=[url anda]&description=[deskripsi url]&picture=[url gambar]&method=post&access_token=[akses token aplikasi facebook]

Cara 2 :

Menggunakan CuRL PHP :

$access_token='akses token aplikasi facebook';
$fbid='
facebook id';
$title='
judul pesan';
$message='
isi pesan';
$link='
url anda';
$description='
deskripsi url';
$picture='
url gambar';
$method='POST';


$attachment =  array(
'access_token' => $access_token,
'message' => $message,
'name' => $title,
'link' => $link,
'description' => $description,
'picture'=>$picture,
'method' =>
$method 
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/".$fbid."/feed");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  //to suppress the curl output
$result = curl_exec($ch);
$response = json_decode($result);
$ResponseId=$response->id;
$PostId=str_replace($fbid."_","",$ResponseId);

curl_close ($ch);



Previous
Next Post »