facebook墙贴在我的代码中有错误

时间:2013-12-17 08:59:05

标签: php facebook

<?php

require_once "src/facebook.php";

 $appId = "**********" ;
 $secret = "************" ;
 $returnurl = "****************";
 $permissions = "manage_page,publish_stream" ;

 $fb = new Facebook(array ('appId' => $appId , 'secret' => $secret)) ;

  $fbuser = $fb->getUser();

 if($fbuser){

if(isset($_post['msg']) and $_post['msg']!=''){
    try{
        $message = array(
            'message' => $_POST['msg']

        );
        $url = '/'.$_POST['pageid'].'/feed';
        $result = $fb ->api($url.'POST',$message);
        if($result){
            echo "The data posted on facebook wall!!";

        }

    }catch (FacebookApiException $error){

        echo $error->getMessage();
    }   

}

try{
    $qry = 'select page_id, name from page where page_id in (select page_id from page_admin where uid = '.fbuser.')';

    $pages = $fb->api(array('method'=>'fql.query','query'=>$qry));

    if(empty($pages)){
        echo "Sorry,the user docs not have any page to post.";

    }else{
        echo '

            <form action="" method="post">
            page : <select name="pageid">';     
            foreach ($pages as $page){

                echo '<option value="'.$pages['page_id'].'">'.$page['name'].'</option>';
            }
        echo    '</select><br/>
            Message : <textarea name="msg"></textarea><br/>
            <input type="submit" value="post to facebook"/>
            </form>
        ';
    }

}catch (FacebookApiException $error){

    echo $error->getMessage();
}   
  }else{

  $loginurl = $fb->getLoginUrl(array('scope'=>$permission , 'redirect-url'=>$returnurl));

  echo '<a href="'.$loginurl.'">Login with Facebook</a>' ;

  }


?>

这是我的代码,这里我使用的是facebook-sdk-php,但问题是我的代码运行正常。当我在我的页面中点击“使用Facebook登录”时,它会给我一个错误。

  

警告:出于安全原因,已在第999行的/home/aspiraes/public_html/haddhai/src/base_facebook.php中禁用了curl_exec()

此错误发生在“base_facebook.php”此页面位于facebook-sdk文件夹名称SRC

0 个答案:

没有答案