[eluser]SPeed_FANat1c[/eluser]
Ok, I have upgraded the site and now trying to integrate it. I wrote such test function:
Code:
function index()
{
$curlcontent="Curl is not installed";
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.facebook.com/restserver.php');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
$curlcontent = curl_exec($ch);
curl_close($ch);
$curlstatus="Curl is available but cannot access Facebook - This is a problem ";
if (strlen($curlcontent)>6) {$curlstatus="Curl is available and can access Facebook - All is OK";}
}
echo $curlstatus;
$this->ci =& get_instance();
// Create our Application instance
//(replace this with your appId and secret).
$this->ci->load->file(APPPATH.'/third_party/facebook.php');
$this->data['facebook'] = new Facebook(array(
'appId' => $this->ci->config->item('id'),
'secret' => $this->ci->config->item('key'),
'cookie' => TRUE,
));
$this->data['session'] = $this->data['facebook']->getSession();
// Session based API call.
if ($this->data['session']) {
echo 'session'; //here it is not echoed.
try {
$this->data['fb_user'] = $this->data['facebook']->getUser();
print_r( $this->data['fb_user']);
return TRUE;
} catch (FacebookApiException $e){
echo 'error';
error_log($e);
}
}
}
So the problem is that
Code:
if ($this->data['session'])
is not TRUE. Any idea how do I solve it? I am loged in at facebook, so as I understand it should get my facebook name.