I normally use only the facebook javascript api, but the login started to give me trouble so I'm trying with the PHP api. This is the api call in my header:
<?
require 'stuff/facebook-php/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'my app id',
'secret' => 'secret',
));
// Get User ID
$user = $facebook->getUser();
?>
I get these messages on my site:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/02/6945202/html/copoetry/index.php:6) in /home/content/02/6945202/html/copoetry/stuff/facebook-php/src/facebook.php on line 37
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/02/6945202/html/copoetry/index.php:6) in /home/content/02/6945202/html/copoetry/stuff/facebook-php/src/facebook.php on line 37
Am I doing something wrong or what could be the issue? Thanks
If you see an error message saying “You can't reply to this conversation,” it might be because: A message or something you shared goes against our Community Standards. You recently sent an unusual number of messages, which may seem like spam to our security system. Messages you sent were marked as unwelcome.
OAuthException: If you receive an OAuthException error, it means that Edgar doesn't have the correct permissions to access your Facebook accounts right now. The password may have been changed on Facebook or Facebook may have reset your security session.
"Cannot send session cookie - headers already sent error"
means you've outputted some data on the page and then tried to set headers. Headers must be sent before any html output.
ALSO
"Cannot send session cookie - headers already sent" comes often when the file is encoded in UTF-8 WITH BOM under Windows. When transfered on an UNIX server the BOM is considered as text and sent before any header you can define.
Make sure to remove any spaces, newlines, or other garbage
before an opening <?php
tag or after a closing ?>
Make sure you didn't output any string (including errors) before starting your session.
Do not use ?>
if you are sure your last line of your file is php code
<?php
require 'stuff/facebook-php/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'my app id',
'secret' => 'secret',
));
// Get User ID
$user = $facebook->getUser();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With