Joesavage Posted May 4, 2010 Share Posted May 4, 2010 I am including a php file with a class called Facebook. I then immediatley call the class Facebook in my php file. It says that the class is undefined. I know that I am including the file correctly because I dont get an error message saying that the file can not be found. Here is what I have, please help. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> </head> <body> <? // // this file includes FB_API_KEY and FB_SECRET constants and the ConnectDB function // to connect to your mysql database. $fbapikey = "xxxx"; $fbsecret = "xxxx"; $con = mysql_connect("localhost","xxx","xxx"); mysql_select_db("xxx", $con); // include("facebookplatform/php/facebook.php"); // start facebook api with the codes defined above. $fb=new Facebook($fbapikey,$fbsecret); //this is where I get the error message. $fb_user=$fb->get_loggedin_user(); Here is what my included file looks like. include_once 'facebookapi_php5_restlib.php'; define('FACEBOOK_API_VALIDATION_ERROR', 1); class Facebook { public $api_client; public $api_key; public $secret; public $generate_session_secret; public $session_expires; public $fb_params; blah blah blah alot more definitions and functions ect. } I have no idea what is going on. I thought this was a simple include, but php says it cant find the class which is clearly defined in the included file. By the way is for facebook Connect, if that matters. Quote Link to comment https://forums.phpfreaks.com/topic/200628-php-include-going-badly/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 4, 2010 Share Posted May 4, 2010 I dont get an error message saying that the file can not be found What does a phpinfo() statement show for your error_reporting and display_errors settings? Quote Link to comment https://forums.phpfreaks.com/topic/200628-php-include-going-badly/#findComment-1052814 Share on other sites More sharing options...
Joesavage Posted May 4, 2010 Author Share Posted May 4, 2010 I dont get an error message saying that the file can not be found What does a phpinfo() statement show for your error_reporting and display_errors settings? I've included an invalid url and I got a clear error message saying the file did not exsist. Quote Link to comment https://forums.phpfreaks.com/topic/200628-php-include-going-badly/#findComment-1052816 Share on other sites More sharing options...
Joesavage Posted May 4, 2010 Author Share Posted May 4, 2010 By some retarded miracle it has now fixed itself. Quote Link to comment https://forums.phpfreaks.com/topic/200628-php-include-going-badly/#findComment-1052817 Share on other sites More sharing options...
PFMaBiSmAd Posted May 4, 2010 Share Posted May 4, 2010 an invalid url You cannot include php code using a URL. You must use a file system path. A URL causes a HTTP request for the file, the same as if you browsed to it. You only receive any HTML output from that file (not to mention it takes 50-100 times longer for a HTTP request than it does reading the file through the file system.) Quote Link to comment https://forums.phpfreaks.com/topic/200628-php-include-going-badly/#findComment-1052818 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.