$response = $twitter->status->update ('Developing a killer new Twitter app!'); Dusty Reagan, @DustyReagan Creator of FriendOrFollow.com Twitter app Learn to: • Turn your ideas into applications • Develop apps with a high chance of success • Find out what users are looking for • Make money from your apps Twitter ® Application Development Making Everything Easier! ™ Open the book and find: • Basics on using HTML, CSS, PHP, and MySQL • How to create and manage your developer account • Advice on choosing an idea for your app • An overview of Web apps, Twitter bots, mobile clients, and more • Twitter’s two APIs • Different ways to monetize your app • Example code for every API method • Code for a complete app Dusty Reagan launched a Web development company called Floating Head Studios in 2007. He developed the hugely popular Twitter app FriendOrFollow.com in 2008, and a few months later launched FeaturedUsers.com, a niche ad network centered around the Twitter ecosystem. Follow him on Twitter at @DustyReagan. $29.99 US / $35.99 CN / £21.99 UK ISBN 978-0-470-56862-0 Programming/Application Development Go to Dummies.com ® for videos, step-by-step examples, how-to articles, or to shop! Discover the fun of building a Twitter app, and earn some cash too! Love Twitter? Know a little (or a lot) about developing applications? Learn how to build a Twitter app, some great ways to make it stand out from the crowd, how to get it discovered, and how to turn your Twitter app-building into a productive little business — all from the creator of FriendOrFollow.com, one of the coolest Twitter apps around! • If your skills are rusty — check Chapter 2 for a quickie refresher course in Web application development • Exploring the ecosystem — explore the types of Twitter apps already available and the five categories of the Twitter ecosystem • The money thing — learn about Twitter’s unusual financial environment and ways you can earn money from your apps • Build a Twitter Web app from the ground up — work with Twitter API libraries, choose a Web hosting provider, and set up a Web framework • Get the word out — discover ways to promote your apps and how to make your app business grow Twitter ® Application Development Reagan spine=.912” www.it-ebooks.info spine=.912” Start with FREE Cheat Sheets Cheat Sheets include • Checklists • Charts • Common Instructions • And Other Good Stuff! Get Smart at Dummies.com Dummies.com makes your life easier with 1,000s of answers on everything from removing wallpaper to using the latest version of Windows. Check out our • Videos • Illustrated Articles • Step-by-Step Instructions Plus, each month you can win valuable prizes by entering our Dummies.com sweepstakes. * Want a weekly dose of Dummies? Sign up for Newsletters on • Digital Photography • Microsoft Windows & Office • Personal Finance & Investing • Health & Wellness • Computing, iPods & Cell Phones • eBay • Internet • Food, Home & Garden Find out “HOW” at Dummies.com *Sweepstakes not currently available in all countries; visit Dummies.com for official rules. Get More and Do More at Dummies.com ® To access the Cheat Sheet created specifically for this book, go to www.dummies.com/cheatsheet/twitterappdev www.it-ebooks.info by Dusty Reagan Twitter ® Application Development FOR DUMmIES ‰ 01_568620-ffirs.indd i01_568620-ffirs.indd i 2/8/10 6:46 PM2/8/10 6:46 PM www.it-ebooks.info Twitter ® Application Development For Dummies ® Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permis- sion of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www. wiley.com/go/permissions. Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/ or its af liates in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITH- OUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FUR- THER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFOR- MATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2010921232 ISBN: 978-0-470-56862-0 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 01_568620-ffirs.indd ii01_568620-ffirs.indd ii 2/9/10 1:31 PM2/9/10 1:31 PM www.it-ebooks.info About the Author Dusty Reagan launched a Web development company called Floating Head Studios in 2007. He developed the popular Twitter app Friend or Follow in 2008, and a few months later launched FeaturedUsers, a niche ad network for the Twitter ecosystem. Follow Dusty on Twitter at @dustyreagan. 01_568620-ffirs.indd iii01_568620-ffirs.indd iii 2/8/10 6:46 PM2/8/10 6:46 PM www.it-ebooks.info 01_568620-ffirs.indd iv01_568620-ffirs.indd iv 2/8/10 6:46 PM2/8/10 6:46 PM www.it-ebooks.info Dedication This book is dedicated to my parents, Randy & Sandy Reagan. Author’s Acknowledgments This book would not have been possible without the patience, love, and encouragement of my wonderful wife, Sharlee. She was beside me through the whole journey, proofreading every word, acting as my sounding board, and being my emotional rock during those tight deadlines. Thank you Shar. I love you! To all of my friends and family who put up with my social absence during the writing of this book, thank you for your encouragement and for enthusi- astically accepting me back into your lives when I crawled out of my writing cave, back into the daylight. Thanks to Chris Treadaway for introducing me to Katie Feltman. Katie, you are a wonderful project editor and writer’s therapist. Thank you for guiding me through this wonderful experience. Pat O’Brien, thank you for your professionalism and editing expertise. Somehow you and Debbye Butler managed to make even my writing publish- able. Thank you Jaisen Mathai (@jmathai) and Abraham Williams (@abraham) for your technical help with OAuth. You are both masters of your trade and exceptionally generous with your knowledge. Follow them on Twitter and pay attention to what they have to say about Twitter API happenings. Thank you for reading. I hope this book brings value to your endeavors. 01_568620-ffirs.indd v01_568620-ffirs.indd v 2/8/10 6:46 PM2/8/10 6:46 PM www.it-ebooks.info Publisher’s Acknowledgments We’re proud of this book; please send us your comments at http://dummies.custhelp.com. For other comments, please contact our Customer Care Department within the U.S. at 877-762-2974, out- side the U.S. at 317-572-3993, or fax 317-572-4002. Some of the people who helped bring this book to market include the following: Acquisitions, Editorial, and Media Development Project Editor: Pat O’Brien Acquisitions Editor: Katie Feltman Copy Editor: Melba Hopper Technical Editor: Vince McCune Editorial Manager: Kevin Kirschner Media Development Project Manager: Laura Moss-Hollister Media Development Assistant Project Manager: Jenny Swisher Media Development Associate Producers: Josh Frank, Marilyn Hummel, Douglas Kuhn, and Shawn Patrick Editorial Assistant: Amanda Graham Sr. Editorial Assistant: Cherie Case Cartoons: Rich Tennant ( www.the5thwave.com) Composition Services Project Coordinator: Sheree Montgomery Layout and Graphics: Ashley Chamberlain, Carl Byers, Joyce Haughey, Melissa K. Jester Proofreader: Sossity R. Smith Indexer: Becky Hornyak Publishing and Editorial for Technology Dummies Richard Swadley, Vice President and Executive Group Publisher Andy Cummings, Vice President and Publisher Mary Bednarek, Executive Acquisitions Director Mary C. Corder, Editorial Director Publishing for Consumer Dummies Diane Graves Steele, Vice President and Publisher Composition Services Debbie Stailey, Director of Composition Services 01_568620-ffirs.indd vi01_568620-ffirs.indd vi 2/8/10 6:46 PM2/8/10 6:46 PM www.it-ebooks.info Contents at a Glance Introduction 1 Part I: Catching Up to Twitter and App Development 5 Chapter 1: Catching Twitter’s Coat Tails 7 Chapter 2: Web Development Refresher Course 13 Chapter 3: Setting Up to Create Twitter Apps 39 Part II: Ideation — Coming Up with an Idea 45 Chapter 4: Getting to Know the Twitter Application Ecosystem 47 Chapter 5: Introducing the Twitter API 63 Chapter 6 : Logging In and Managing Your Account 79 Chapter 7: Managing Users and Their Relationships 105 Chapter 8: Communication Through Tweets 179 Chapter 9: Selecting an Idea 241 Part III: Creation — Developing Your Application 249 Chapter 10: Selecting Libraries, Design Patterns, and Frameworks 251 Chapter 11: Hosting In the Clouds 255 Chapter 12: Coding Your Application 269 Chapter 13: Making It Pretty Makes It Credible 309 Chapter 14: What You Need to Know to Grow 315 Part IV: Monetization — Making Money with Your Application 321 Chapter 15: How Twitter Makes Money 323 Chapter 16: Advertising 327 Chapter 17: Monetizing with Other Models 335 Chapter 18: Promoting Your Application 345 Part V: The Part of Tens 355 Chapter 19 : Ten Traits of a Respectable Twitter Developer 357 Chapter 20: Ten Twitter API Tips 361 02_568620-ftoc.indd vii02_568620-ftoc.indd vii 2/8/10 9:38 PM2/8/10 9:38 PM www.it-ebooks.info Appendix A: Twitter API Reference 365 Appendix B: Gallery of Twitter Applications 395 Index 413 02_568620-ftoc.indd viii02_568620-ftoc.indd viii 2/8/10 9:38 PM2/8/10 9:38 PM www.it-ebooks.info [...]... need to know about is right here If you find the need for additional information on related topics, plenty of other For Dummies books can help www.it-ebooks.info 2 Twitter Application Development For Dummies What You Don’t Need to Read Aside from the topics you can use right away, some of this book is skippable I carefully placed extra-technical information in self-contained sidebars and clearly marked... to Twitter and App Development www.it-ebooks.info T In this part he chapters in this part present a layperson’s introduction to what Twitter development is all about www.it-ebooks.info Chapter 1 Catching Twitter s Coat Tails In This Chapter ▶ Why Twitter is a compelling platform ▶ The rationale behind building a Twitter app A few years ago a small Web site called Twitter appeared on the Internet Twitter. .. entrepreneurs is the open API Twitter provides all its data and functionality for free as an open API This means you can invent and build new applications around Twitter s functionality You can even create a whole new Twitter interface from the ground up Twitter encourages development with its API and has even acquired companies that build spectacular applications on top of Twitter Twitter’s current search... www.it-ebooks.info Introduction W elcome to the first edition of Twitter Application Development For Dummies, the book written especially for people who want to create Twitter applications but haven’t a clue about how to start About This Book There are a couple of ways to use this book, depending on your preferences and experience If you’re a Twitter newbie, you can start reading and working with Chapter... 18 Formatting in XML & JSON 24 The Basics of PHP 25 Conditional Statements 26 Loops 28 Functions 29 Arrays 30 cURL 31 PHP DOMDocument Class 33 PHP json_decode Function 35 Understanding MySQL 35 www.it-ebooks.info x Twitter Application Development For Dummies Chapter 3: Setting Up to Create Twitter. .. Austin One of Twitter s strengths is that it doesn’t limit what people can do with it Nor do they presume to know exactly how everyone should interact with it The founders of Twitter have left it up to the users to discover what Twitter is to be used for and how Some now common features of Twitter were originally derived out of how the Twitter community decided to use the application @ replies for instance... survived News of the event spread quickly on Twitter before any major media outlet could cover the event www.it-ebooks.info Chapter 1: Catching Twitter s Coat Tails Trends are helpful in finding recent interesting topics, but if you’re looking for news on a particular subject, you can use Twitter s search functionality Using Twitter Search, you can monitor Twitter for words and phrases in near real-time... command that pays off big www.it-ebooks.info 3 4 Twitter Application Development For Dummies Did I tell you about the memory course I took? Danger, Will Robinson! This icon highlights information that may help you avert disaster Where to Go from Here Yes, you can get there from here With this book in hand, you’re ready to build your own robust and useful Twitter application Browse through the table of contents... In This Chapter ▶ The basics of Web development ▶ A look at the LAMP stack ▶ Reference material for the Web developer A n interesting thing about Twitter application development is you can interact with the API in any language and on any platform Windows clients, iPhone applications, and Android apps use different programming languages and still interact with the Twitter API in similar ways In this... business around Twitter www.it-ebooks.info 8 Part I: Catching Up to Twitter and App Development ✓ Promote a business with Twitter and interact with customers ✓ Get involved in politics ✓ Stay informed of breaking current events as they happen ✓ Talk to influential people and celebrities These are just a few common reasons why someone might be on Twitter There are even more creative uses of Twitter In Chapter . specifically for this book, go to www .dummies. com/cheatsheet/twitterappdev www.it-ebooks.info by Dusty Reagan Twitter ® Application Development FOR DUMmIES ‰ 01_568620-ffirs.indd. Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies. com, Making