<?php
// Include facebook class (make sure your path is correct)  
require_once("fbsdk/src/facebook.php");

// Create our Application instance (replace this with your appId and secret).  
$facebook = new Facebook(array(  
  'appId'  => '314839808328',
  'secret' => 'bca381f7bf1333c7160c3cce4b386577',
  'cookie' => true,  
));  
  
//$token is the access token from the URL above  
//$post = array('access_token' => '253158104713926|17beda06878c215b46de5610.0-724601604|KRr0dgxMfGVusY5BjoaWuDPSM3k', 'message' => 'new test post - ' . date('Y-m-d'));
  
//try{
//$res = $facebook->api('/me/feed','POST',$post);
//print_r($res);
  
//} catch (Exception $e){
  
//    echo $e->getMessage();
//}
 //$token is the page access token variable from above
$post = array('access_token' => '253158104713926|17beda06878c215b46de5610.0-724601604|314839808328|keVJg98VfrJTkikS1_CYiY618wk', 'message' => $postdata . date('Y-m-d'));
echo $post;

try{
$res = $facebook->api('/314839808328/feed','POST',$post);
//print_r($res);
echo "<br><font color=red>Coupon posted on Facebook.</font>";

} catch (Exception $e){

    echo $e->getMessage();
}
 ?>
