i am building a facebook app which is somehow generating these weird errors. the following are the errors I am facing:
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/index.php:2) in /home/amitver/public_html/roadies/facebook.php on line 395
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/index.php:2) in /home/amitver/public_html/roadies/facebook.php on line 395
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/index.php:2) in /home/amitver/public_html/roadies/facebook.php on line 395
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/index.php:2) in /home/amitver/public_html/roadies/facebook.php on line 399
the first few lines in index.php are:
<?php
require_once 'facebook.php';
//facebook init
$appapikey = '...';
$appsecret = '...';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
$userInfo = $facebook->api_client->users_getInfo($user_id, array('name'));
$name = $userInfo[0]['name'];
//$useruidname = $facebook->api_client->fql_query("SELECT name FROM user WHERE uid='$user_id'");
// Greet the currently logged-in user!
echo 'Hello, '.$name;
?>
the lines 394-400 in facebook.php are:
foreach ($cookies as $name => $val) {
setcookie($this->api_key . '_' . $name, $val, (int)$expires, '', $this->base_domain);
$_COOKIE[$this->api_key . '_' . $name] = $val;
}
$sig = self::generate_sig($cookies, $this->secret);
setcookie($this->api_key, $sig, (int)$expires, '', $this->base_domain);
$_COOKIE[$this->api_key] = $sig;
can someone help me solve this?