the developers guide to social programming

335 401 0
the developers guide to social programming

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info The Developer’s Guide to Social Programming www.it-ebooks.info T he Developer’s Library Series from Addison-Wesley provides practicing programmers with unique, high-quality references and tutorials on the latest programming languages and technologies they use in their daily work. All books in the Developer’s Library are written by expert technology practitioners who are exceptionally skilled at organizing and presenting information in a way that’s useful for other programmers. Developer’s Library books cover a wide range of topics, from open- source programming languages and databases, Linux programming, Microsoft, and Java, to Web development, social networking platforms, Mac/iPhone programming, and Android programming. Visit developers-library.com for a complete list of available products Developer’s Library Series www.it-ebooks.info The Developer’s Guide to Social Programming Building Social Context Using Facebook, Google Friend Connect, and the Twitter API Mark D. Hawker Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Cape Town • Sydney • Tokyo • Singapore • Mexico City www.it-ebooks.info Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States please contact: International Sales international@pearson.com Visit us on the Web: informit.com/aw Library of Congress Cataloging-in-Publication Data: Hawker, Mark D. The developer’s guide to social programming : building social context using Facebook, Google friend connect, and the Twitter API / Mark D. Hawker. p. cm. ISBN 978-0-321-68077-8 (pbk. : alk. paper) 1. Online social networks. 2. Entertainment computing. 3. Internet programming. 4. Google. 5. Facebook (Electronic resource) 6. Twitter. I. Title. HM742.H39 2010 006.7’54—dc22 2010020866 Copyright © 2011 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copy- right, and permission must be obtained from the publisher prior to any prohibited reproduction, stor- age in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc Rights and Contracts Department 501 Boylston Street, Suite 900 Boston, MA 02116 Fax (617) 671 3447 ISBN-13: 978-0-321-68077-8 ISBN-10: 0-321-68077-4 Text printed in the United States on recycled paper at RR Donnelley Crawfordsville in Crawfordsville, Indiana. First printing, August 2010 www.it-ebooks.info ❖ To Mam and Dad, I am forever grateful for your patience, understanding, love, and support. More than you will ever know.And to my brother, Dale, who continues to pleasantly surprise us all. I will love you always. “Some dreams are dressed in gossamer and gumboots; ethereal hope undergirded by practical endeavour.” SarahJayne Vivian ❖ www.it-ebooks.info Contents at a Glance I: Twitter 1 Working with the Twitter API 1 2 Diving Into the Twitter API Methods 21 3 Authentication with Twitter OAuth 45 4 Extending the Twitter API: Retweets, Lists, and Location 61 II: Facebook Platform 5 An Overview of Facebook Platform Website Integration 77 6 Registration, Authentication, and Translations with Facebook 99 7 Using Facebook for Sharing, Commenting, and Stream Publishing 115 8 Application Discovery, Tabbed Navigation, and the Facebook JavaScript Library 137 III: Google Friend Connect 9 An Overview of Google Friend Connect 165 10 Server-Side Authentication and OpenSocial Integration 193 11 Developing OpenSocial Gadgets with Google Friend Connect 209 IV: Putting It All Together 12 Building a Microblog Tool Using CodeIgniter 235 13 Integrating Twitter, Facebook, and Google Friend Connect 267 www.it-ebooks.info Table of Contents I: Twitter 1 Working with the Twitter API 1 Twitter API Essentials 1 Twitter API Methods 3 Twitter API Parameters 6 Twitter API Return Formats 10 Accessing the Twitter API 11 cURL 12 Twitter-async 14 Twitter API Rate Limiting 17 Twitter API Error Handling 18 Summary 19 2 Diving Into the Twitter API Methods 21 Twitter API Methods 21 User Objects 23 Status Objects 26 Direct Message Objects 28 Saved Search Objects 29 ID Objects 30 Relationship Objects 31 Response Objects 32 Hash Objects 33 Twitter Search API 34 Introducing the Atom Syndication Format 34 Twitter Search API Methods 38 Summary 43 3 Authentication with Twitter OAuth 45 Introducing Twitter OAuth 45 OAuth Benefits 46 OAuth Definitions 46 www.it-ebooks.info viii Contents Implementing Twitter OAuth 48 Twitter OAuth Workflow 48 Test Tube: A Sample Twitter Application 50 Summary 59 4 Extending the Twitter API: Retweets, Lists, and Location 61 Extending Twitter’s Core Functionality 61 Retweet API 62 Lists API 64 Geolocation API 68 Twitter Community Evolution 71 Platform Translations 71 Spam Reporting 72 Future Directions 74 Summary 76 II: Facebook Platform 5 An Overview of Facebook Platform Website Integration 77 Facebook Platform for Developers 77 Facebook Platform 78 Registering a Facebook Application 79 Referencing a Facebook Platform Application 81 Facebook API, FQL, and XFBML 84 Facebook API and FQL 84 XFBML 97 Summary 98 6 Registration, Authentication, and Translations with Facebook 99 User Authorization and Authentication 99 Logging In and Detecting Facebook Status 101 Logging Out, Disconnecting, and Reclaiming Accounts 107 www.it-ebooks.info ix Contents Connecting and Inviting Friends 109 Translations for Facebook 111 Preparing Your Application and Registering Text 111 Administering and Accessing Translations 113 Summary 114 7 Using Facebook for Sharing, Commenting, and Stream Publishing 115 Content-Sharing and Live Conversation 115 Facebook Share 116 Facebook Widgets 118 Social Commenting and Stream Publishing 120 Comments Box 120 Open Stream API 123 Summary 135 8 Application Discovery, Tabbed Navigation, and the Facebook JavaScript Library 137 Application Dashboards and Counters 138 News and Activity Streams 139 Games and Applications Counters 143 Navigating and Showcasing Your Application Using Tabs 145 Configuring and Installing an Application Tab 146 Extending an Application Tab 149 Dynamic Content and the Facebook JavaScript (FBJS) Library 157 Facebook Animation Library 157 Facebook Dialogs 160 Handling Events with an Event Listener 162 Summary 164 III: Google Friend Connect 9 An Overview of Google Friend Connect 165 Components of Google Friend Connect 165 Google Friend Connect Gadgets 166 www.it-ebooks.info [...]... important to also see how each is distinct and to prepare you for changes through examples and sample code .The purpose of these examples is to provide a springboard to build applications on, so there is plenty of room for extending and adapting to suit your own needs.This book is one of the first of its kind to bring together three of the most popular social programming platforms under one hood Welcome to social. .. page parameters to retrieve the maximum number of results For example, by setting count to 100, you can iterate through pages 1–32 to extract all available status updates Note that the page parameter begins with 1, not 0.These parameters are scheduled to be deprecated in favor of cursor-based pagination .The rpp parameter is specific to the Search API and is akin to the count parameter .The default is... commonly used on blogs and news sites.Atom was created as an alternative to RSS to accommodate some of the flaws in the RSS protocol and to improve international support Both RSS and Atom are used to accommodate people who want to “subscribe” to Twitter information streams, such as the public timeline or a particular user’s timeline www.it-ebooks.info Accessing the Twitter API n XML Extensible Markup... http://curl.haxx.se/download.html for almost any operating system If you download the version with Secure Sockets Layer (SSL), you need to ensure that all the necessary files are included in the package.You can find whether you have all the necessary files by navigating to the directory where you have saved the cURL files and trying to run the command curl If you get the following response, you’ve succeeded: curl: try "curl... given only their user identifiers The blocks/exists/ method checks whether a specified user has been blocked by the authenticated user n Direct messages methods The direct_messages method retrieves a number of messages that a user has received and works alongside the direct_messages/sent method, which refers to the messages that the authenticated user has sent n Favorites methods The favorites... notifications/leave/ methods to set which friends they receive updates from n Saved searches Users sometimes may want to store frequently requested searches into their profile so that they are easy to access at later dates .The saved_searches/create and saved_searches/destroy/ methods make this action seamless n Statuses You can use status methods to create statuses (statuses/update) and to delete them (statuses/destroy/).You... Contacting the Author If you have any questions or comments about this book, please send an e-mail to socialprogramming@gmail.com.You can also visit the book’s website, http://www socialprogramming.info, for updates, downloadable code examples, and platform news An active code repository will be maintained, http://github.com/markhawker/SocialProgramming, which you can use to post issues you have with the. .. from the conventional structures of the other Twitter API methods .The DELETE operation instructs the Twitter servers to remove the requested resource and does not return a response value to guarantee that this has been performed successfully It is recommended that applications use the POST operation wherever possible because both successful and unsuccessful attempts will be reported to the requestor... interacting with the Search API, although it is not a requirement to use the format at all (because JSON is supported by all Twitter API methods) Accessing the Twitter API Most Twitter API requests require user authentication to access data that is not otherwise open to the public, such as direct messages or favorites, and to control Twitter rate limiting Historically,Twitter has implemented Basic Authentication,... category .The method stub will help you translate methods back into the language used by Twitter to describe the methods in their official documentation Most categories are organized logically and include methods to perform each of the standard CRUD (Create, Read, Update, and Delete) operations .The Search API methods that have the stubs search and trends use the https://search.twitter.com/ prefix, and all other . and adapting to suit your own needs.This book is one of the first of its kind to bring together three of the most popular social programming platforms under one hood. Welcome to social programming. Who. created to demonstrate Google Friend Connect in action. Part IV,“Putting It All Together,” pulls each of the three social platforms together into a coherent whole and demonstrates how to create. platforms, Mac/iPhone programming, and Android programming. Visit developers- library.com for a complete list of available products Developer’s Library Series www.it-ebooks.info The Developer’s Guide to Social Programming Building

Ngày đăng: 24/04/2014, 16:10

Từ khóa liên quan

Mục lục

  • Table of Contents

  • I: Twitter

    • 1 Working with the Twitter API

      • Twitter API Essentials

      • Accessing the Twitter API

      • Summary

      • 2 Diving Into the Twitter API Methods

        • Twitter API Methods

        • Twitter Search API

        • Summary

        • 3 Authentication with Twitter OAuth

          • Introducing Twitter OAuth

          • Implementing Twitter OAuth

          • Summary

          • 4 Extending the Twitter API: Retweets, Lists, and Location

            • Extending Twitter’s Core Functionality

            • Twitter Community Evolution

            • Summary

            • II: Facebook Platform

              • 5 An Overview of Facebook Platform Website Integration

                • Facebook Platform for Developers

                • Facebook Platform

                • Facebook API, FQL, and XFBML

                • Summary

                • 6 Registration, Authentication, and Translations with Facebook

                  • User Authorization and Authentication

                  • Connecting and Inviting Friends

                  • Translations for Facebook

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan