1

Here is my code:

$fb = new Facebook\Facebook([
'app_id'                => '1111111', // api key
'app_secret'            => '22222222', // secret api key
'default_graph_version' => 'v2.5'
]);

And finally I always get this error:

Parse error: syntax error, unexpected '[', expecting ')' in...

Where is a problem?

NewbieUser
  • 191
  • 2
  • 10

1 Answers1

1
$fb = new Facebook\Facebook(array(
'app_id'                => '1111111', // api key
'app_secret'            => '22222222', // secret api key
'default_graph_version' => 'v2.5'
));


Thank you,
Tom

  • OK, that "works" but then I got this: "Fatal error: Uncaught exception 'Exception' with message 'The Facebook SDK requires PHP version 5.4 or higher.' in (...)". So which Facebook SDK version I should use to work with this script ?? – NewbieUser Feb 14 '16 at 09:23
  • I use version 3.2. That's year 2013; it works,though. Please look at the SDK versions available **and** the required PHP version to use that particular SDK. – Tom Chadaravicius Feb 14 '16 at 09:26
  • In case anyone has been doing too much javascript, like me, he switched the `[ ]` to `array( )` – Jacksonkr Jan 04 '17 at 23:59