Social media is very important to today’s websites. In addition to your website, you may also be maintaining a Twitter account and a Facebook page for your users to stay in the loop. You may simply post on these medias when you have new content, or you may use them for little updates not worthy of a large section of your website but of interest to your users. Regardless of how you use Facebook and Twitter, you may want to know more about how you can get your PHP to interact with them. Both Facebook and Twitter have developer resources to help you design software to interact with their services. Including social media on your website is defiantly possible using PHP. You just need to take a few mins and look at all of the very useful information provided by these huge social media services.
Facebook has an SDK (software developer’s kit) particularly for PHP developers. It has guides for how to do some simple things with PHP and Facebook, as well as classes that you can use directly within your software. The first guide available to you shows you how to retrieve a user’s profile. This can be very handy if you want to allow people to register for your site using their Facebook account. It makes setting up a new account super easy for anyone who is already on Facebook.
The next SDK guide shows you how to share a link. This is nice to have if you want users to be able to share articles, photos and other content from your website with their friends. Giving each article you write a Facebook button to easily post it will make sure it gets shared far more often than if a user had to manually share it. The more people you get your site out to the better, so take advantage of free word of mouth advertising!
Finally there is a SDK guide for uploading a photo. Depending on what your software does, you may want to allow users to store photos on Facebook. Maybe your program lets the user edit a photo, or perhaps it generates a graphic or a graph of some sort. You can then allow the user to put this content on Facebook, again creating free word of mouth advertising for your software.
Most of the BaseFacebook classes that are already written for you in PHP have to do with logging in and out of Facebook. Some work with creating and destroying the user session, or working with Facebook apps. You can also check for file upload support.
The developer resources offered by Twitter are not PHP specific. Basically they give you a list of requests that you can send to them to get information back. You could get the most recent post by a specific user, or you could look for posts that mention a specific user. You could also look for people who are retweeting a specific user. Maybe you are interested in Twitter in a more general way, and could just show the most recent tweets by anyone.
You can also use these commands to add information to Twitter. This is helpful if you want to create software that allows a user to tweet or retweet from within it. This is also useful if you want to include a “tweet this” type button from your articles. Again, people are more likely to share your content if you make it easy for them, and you want all the free word of mouth advertising you can get online.
Finally you can manage friends and followers via remote code on Twitter. This is useful if you want to provide a full Twitter or social media management from