-1
我正在尝试使用PHP(Codeigniter)执行脚本后向我的Facebook页面发布url/status。目前,我收到以下错误uncaught oauthexception invalid oauth access token signature.
我知道问题是与事实我的访问令牌是错误的,但无论我在Facebook上阅读多少文档,我似乎无法弄清楚。有人可以给我一个解决方案,我将如何获得访问令牌?无法获取Facebook访问令牌?
include('system/libraries/facebook.php');
if($this->session->userdata('level') == "admin"){
$role = $this->input->post('role');
$company = $this->input->post('company');
$location = str_replace('+', ' ', $this->input->post('location'));
$category = str_replace('+', ' ', $this->input->post('category'));
$type = str_replace('+', ' ', $this->input->post('type'));
$description = $this->input->post('description');
$extract = $this->input->post('extract');
$date = time();
$link = $this->input->post('link');
if($this->input->post('closing_date')){
$closing_date = $this->input->post('closing_date');
$closing_date = str_replace('/', '-', $closing_date);
$closing_date = strtotime($closing_date);
}else{
$closing_date = time() + 2592000;
}
$url = str_replace(' ', '-', trim($role));
$location_dash = str_replace(' ', '-', trim($location));
$url = $url."-in-".$location_dash;
$this->db->set('role', $role);
$this->db->set('company', $company);
$this->db->set('type', $type);
$this->db->set('location', $location);
$this->db->set('category', $category);
$this->db->set('url', strtolower($url));
$this->db->set('description', $description);
$this->db->set('extract', $extract);
$this->db->set('link', $link);
$this->db->set('time', $date);
$this->db->set('closing_date', $closing_date);
$this->db->set('active', 1);
$this->db->insert('jobs');
$job = $this->db->get_where('jobs', array('time' => $date))->row_array();
$url = "http://www.example.com/job/view/".$job['id']."/".$job['url']."";
$facebook = new Facebook(array(
'appId' => '***',
'secret' => '***'
));
$message = array(
'access_token' => "***",
'message'=> "".$url.""
);
$facebook->api('/me/accounts','POST', $message);
_“我知道问题与我的访问令牌是错误的事实有关_”,所以您认为它很适合展示为一些无趣的代码,除了你自己获取该访问令牌...? – CBroe
@CBroe我目前从这里获取我的access_token https://developers.facebook.com/tools/explorer/?method=GET&path=me/accounts,但不确定我是否得到正确的访问代码 – learn
你必须得到令牌在Graph API Explorer中使用您自己的应用程序(从顶部的下拉列表中选择),否则它将用于GAE应用程序,因此与您的app_id/app_secret不匹配。 – CBroe