120x600

Suggestions

Zip file

umefarooq (in the comments on page 4) requested a zip file for the tutorial. Here it is.

To get the files in the zip file to work, you need to change the values for app_id and application_secret in the facebook_model.php file, and the appId value near the bottom of the two view files.

getFriendArray() improvement

gerardguiu suggested an improvement to the getFriendArray() function in my model. He added the following code into my foreach() loop:


	$friends[$friend['id']] = array(
  		'name' => $friend['name'],
  		'picture' => 'http://graph.facebook.com/'.$friend['id'].'/picture'
	);

Now the array returns the user id, user name, and profile picture.

Errors, and their solutions

No data in "user" object

Eric (in the comments on page 3) was having issues with the user object being populated. We emailed back and forth a couple of times. He figured out that the problem was that he was using Elliot Haughin's library along with my solution. Apparently, they conflict with each other. He tried my code on another CodeIgniter application that did not contain Elliot's library, and my code worked fine.

Problem with SSL

Eric also had a problem with my code using SSL. He found that the problem was that his web hosting server did not have the OpenSSL wrapper for PHP enabled, preventing him from doing "https" Facebook requests.