Using Yahoo! Social SDK for PHP

Getting Started

Requirements

  • A web server with PHP installed

Creating A New Application

In order to start working with the SDK, you'll need to get a new web-based application ID and OAuth consumer key and secret. These keys will provide you with general access to the Yahoo! Social Platform, and allow your users to authorize your application to access protected resources and information.

You can get a new application here, or view your current apps in My Projects.

Get The Sample Code

The source code and sample application is hosted publicly on GitHub at http://github.com/yahoo/yos-social-php.

  • After downloading, untar or unzip the package and place the contents of yosdk/lib/ in an appropriate location on your server.
  • For more installation information, please read the included INSTALL.txt document.
  • Documentation and a sample application are included in the download.

Using the SDK

Creating a session:

To create a new session using YahooSession::requireSession, initialize it by using your consumer key, consumer secret and application ID you just got as parameters. From here, the SDK will detect it's environment and create a session. (It may re-direct the user to log-in if needed.)

Fetching User Data

Once a session is initialized (and the user has authorized access to the application) you can now access social information for the logged-in user. The depth of user data you can access will depend on the permissions for which your application asked.

Each method returns a standard PHP object (the decoded JSON response from the API).

Posting User Activities

Yahoo! provides two means for you to share your user's activities back to other Yahoo! users:

  • Status: A line of text describing what a user is currently doing.
  • Updates: A user's stream of shared activities. (Each containing, at the very least, a line of developer-supplied text, your icon and a link back to your application.)

You can use these channels to advertise your user's use of your app to a large audience of Yahoo! users, driving this larger group to your product.

The sample code below shows how to set a user's status and post an update to their activity stream.

Using YQL

Using Yahoo! Query Language (YQL) in your applications lets you query for data across many other Yahoo! APIs and other data sources across the internet. Learn more about Yahoo! Query Language (YQL) here.

The sample query below gets the user's location and queries the GeoPlanet API in order to return structured place data.

Good Things To Know

Assets

Check out the ready to use sign-in buttons on the Yahoo! Updates Assets page.

Support

Questions and suggestions on the SDK are discussed on the YOS Developer forum. If you have any questions or need technical support, please use this forum.

Licensing

The SDK source code and samples are provided free of charge, subject to the Yahoo! Social SDK License, unless otherwise noted.

Terms of Use

Use of the Yahoo! Social APIs is governed by the Yahoo! APIs Terms of Use.

Your use of YQL is subject to the YQL Terms of Service.

Ready to get started?

Use of the Yahoo! APIs is governed by the Yahoo! Terms of Use.

Yahoo! Forum Discussions