我正在长时间搜寻如何从Facebook抓取数据,但无法正常工作。
这是我的代码,代码不返回任何东西。
我是scrape域的新手,所以请帮助我,我必须做的事情,必须更改或修复的地方
$providername='https://www.facebook.com/groups/1818427425114105/';
$key=$this->config->item('key', $providername);
$secret=$this->config->item('secret', $providername);
$this->load->helper('url_helper');
$this->load->spark('oauth2/0.3.1');
$provider=$this->oauth2->provider($providername, [
'id'=>$key,
'secret'=>$secret,
]);
//var_dump($provider);
if(!$this->input->get('code'))
{
if($providername=='facebook')
{
$url='https://www.facebook.com/'.$provider->redirect_uri;
redirect($url);
}
// By sending no options it'll come back here
$provider->authorize();
}
else
{
try
{
$token=$provider->access($_GET['code']);
$user=$provider->get_user_info($token);
print_r($user);
die;
$this->saveData($providername, $token, $user);
}
catch(OAuth2_Exception $e)
{
show_error('That didnt work: '.$e);
}
}