Automatically post to a Page using PHP Facebook/twitter SDK

Automatically post to a Page using PHP Facebook/twitter SDK


require_once 'Mage/Review/srcfile/facebook.php';
            // $PAGE_ID = "100000706975464"; // The page you want to post to (you must be a manager)   
            // $FACEBOOK_APP_ID = "814286258597255"; // Your facebook app ID
            // $FACEBOOK_SECRET = "b0db26d4079ff9db9f8d2e04d9f845b2"; // Your facebook secret
            // $ACCESS_TOKEN="814286258597255|b0db26d4079ff9db9f8d2e04d9f845b2"; // The access token you receieved above
            // $PAGE_TOKEN = "CAALklsswbYcBAEYEEZATyK1ZBChfrz33kC6WIxKEO6mfCEPZAyP46VVZAm5v7ZCYltUbNPizdv8dhireZB33Xe5KnBgeqeGTATMAuWTNClvql7PenhZAP1wVgjQExQ0Vx0VRemni5DeJYqQObHvjxQOaPEZAjhDLuer32CX8VQvZC8ZAAAePIhGPeY0Yxz8SVvStwRvD14cGIoSgZDZD"; // Leave this blank. It will be set later

            $facebook = new Facebook(array(
             'appId' => '814286258597255',
             'secret' => 'b0db26d4079ff9db9f8d2e04d9f845b2',
             'cookie' => true,
            ));
           
            //$token is the access token from the URL above
           
            $post = array('access_token' => '814286258597255|b0db26d4079ff9db9f8d2e04d9f845b2', 'message' =>'any message','name' => 'name','description'=> 'description','link'=>'http://120.72.91.51/magento-projects/magentoapp/','caption' =>'caption');
            try{
            $res = $facebook->api('/100000706975464/feed','POST',$post);
            } catch (Exception $e){
            echo $e->getMessage();
            }
                               
            include_once('src/codebird.php');
            \Codebird\Codebird::setConsumerKey("GwLRE0mqCo1VqXGNE4mFg", "AdKnwh3ax9rcBKeBRq0Gf7XUNUgJpGKUYyzTTtAgqE");
            $cb = \Codebird\Codebird::getInstance();
            $cb->setToken("454678072-O4lTAPoO8ZaAUrmHvXGcavIYnwFT6hiBMTceaQJN", "9mi5TpysBRCn3pcmfbaj9ewXXl6k5dLkkJKjSoLDyjgP4");
            $data   = $this->getRequest()->getPost();
            $product = $this->_initProduct();
            $params = array(
                  'status' => $product->getName().'Review by Customer'.$data['detail']
                );
            $reply = $cb->statuses_update($params);

Comments