Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Taming the Snoo: Playing with the Reddit API
Feb 14, 2017 @ 11:56:58

The SitePoint PHP blog has a new tutorial posted by author Claudio Ribeiro looking at how to "tame the snoo" - using PHP to work with the Reddit API via an OAuth application.

Reddit is a social networking, entertainment, and news website where the content is almost exclusively submitted by users.

[...] Reddit also offers its own API. This way, we can use all the information available on Reddit to enrich our own websites or build our own Reddit clients. In this article, we will tackle some basic Reddit API usage with PHP.

The tutorial starts with a brief overview of the Reddit API and the functionality they're focusing on: the "search" method. Example URLs are included showing the searching of terms, pagination options, sorting and other restrictions. They then bring PHP into the mix, using the Guzzle HTTP library to create a basic "Searcher" class. They also use the Twig templating system to output the results (simple template included). Finally they show how to make the OAuth application on your Reddit account, pull in the "adoy/oauth2" package and the code to connect your service via OAuth to the Reddit API.

tagged: snoo reddit api tutorial guzzle twig search

Link: https://www.sitepoint.com/taming-the-snoo-playing-with-the-reddit-api/