Using third-party APIs

That was enough theory about REST APIs; it is time to dive into a real world example. In this section, we will write a small PHP application that interacts with Twitter's REST API; that includes requesting developer credentials, authenticating, and sending requests. The goal is to give you your first experience in working with REST APIs, and showing you that it is easier than you could expect. It will also help you to understand better how they work, so it will be easier to build your own later.

Getting the application's credentials

REST APIs usually have the concept of application. An application is like an account on their development site that identifies who uses the API. The credentials that you will use to access the ...

Get Learning PHP 7 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.