Over the past few months I’ve been rewatching one of my favorite TV shows, Alias, on Netflix. For those of you who haven’t experienced this television classic, Alias follows CIA agent Sydney Bristow as she travels around the world solving mysteries and beating up bad guys. If you are like me you’ve probably always wanted to tap into your inner Sydney Bristow and become a kick-ass CIA spy. Today I’m going to show you how to use PHP, FilePreviews.io and Twilio MMS to come one step closer to that dream. We’re going to build an app that lets you snap a picture of a Caesar ciphered text, send it to a phone number and get a response with the decoded text. If you’re in a rush to save the world, you can find the finished code for our app on GitHub.

Our Tools

PHP

Twilio Account and MMS Enabled Twilio Number

FilePreviews.io Account – We’ll use this API to run the OCR on our images.

How It Works

Want to try it out now? Download this image of a Caesar ciphered text and send it to (646) 791-3807.

Analyzing Our Image

In order to detect text from our images we’re going to use OCR (optical character recognition). OCR is a very hard task. When I encounter hard problems I try to find APIs to make them easier. Enter FilePreviews.io. FilePreviews does a lot of really cool things with files but most important to us it lets you send in an image and returns the OCR results for that image. Exactly the tool we need in our spy toolkit.

To get started, sign up for a FilePreviews account and create a new app. Make note of the API key you get for this new app, we’ll be using it shortly.