i copied some html code for a facebook application but i seem to get the following error
Fatal error: Class \'Facebook\' not found in /home/content/73/7931773/h
I got this error and found it was caused by "Facebook needs the CURL PHP extension" at root. Installing CURL for PHP fixed it.
<?php
$facebook_appid='';
$facebook_app_secret='';
$facebook = new Facebook(array('appId' => $facebook_appid,'secret' => $facebook_app_secret,));
?>
The error you get just means that the class Facebook
does not exists. Therefore you can create an instance of it like in this line of code:
$facebook = new Facebook(array(
The require statement of the facebook.php file suggests that it might provide the class definition of the Facebook
class. Obviously it does not. So if you ask
1 . What is the significane of facebook.php
This can not be properly answered as your question does not provide any information about that file at all.
2 . how do i get rid of this error .
You get rid of this error by providing the class definition of the Facebook
class prior to creating a new object instance. The other way would be to not create an instance of the Facebook
class at all. This will remove the error as well. However I think that is not intended by you. So just include all files needed and you should be fine to go.
To do this, locate the Facebook API on your disk. Then put the full path into the require statement to that file.
ZIP and TAR.GZ files of the API can be downloaded on the Facebook PHP-SDK Download Page. The files in question are in the src
sub-folder therein.
That facebook call belongs to the Facebook PHP SDK. It instantiates the facebook class. You are getting the error probably because you dont have the facebook.php in the same folder as your script.
To get rid of the error. Either remove facebook object from your application or get the facebook class.
Here is the link. https://github.com/facebook/php-sdk