GithubHelp home page GithubHelp logo

yahooarchive / yos-social-php5 Goto Github PK

View Code? Open in Web Editor NEW
75.0 20.0 33.0 778 KB

[dormant] Yahoo! Social SDK - PHP5 library

License: Other

PHP 99.46% CSS 0.21% JavaScript 0.13% Shell 0.19%
dormant

yos-social-php5's Introduction

Yahoo! Social SDK - PHP5

Warning

The yos-social-php5 SDK is released alpha and is experimental. The difference between the yos-social-php5 sdk and the yos-social-php sdk is that the storage is left for the user to implement. The new implementation is more flexible as developers can store the OAuth tokens in a php session, in a database, or in memcache. It does not require php sessions unless a partner wants it to. This means there is no method equivalent to 'hasSession' or 'requireSession'. An example of how this functionality could be implemented is in the yos-social-php5/examples/simpleauth/simpleauth.php.

Find documentation and support on Yahoo! Developer Network: http://developer.yahoo.com

Hosted on GitHub: http://github.com/yahoo/yos-social-php5/tree/master

License

@copyright: Copyrights for code authored by Yahoo! Inc. is licensed under the following terms: @license: BSD Open Source License

Yahoo! Social SDK Software License Agreement (BSD License) Copyright (c) 2009, Yahoo! Inc. All rights reserved.

Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The Yahoo! Social PHP SDK code is subject to the BSD license, see the LICENSE file.

Requirements

The following dependencies are bundled with the Yahoo! PHP SDK, but are under terms of a separate license. See the bundled LICENSE files for more information:

Installation

After downloading and unpacking the release, copy the contents of 'lib' to a directory that is accessible via the PHP include_path method.

Examples

The sdk comes with example code, but you must first upcate the file 'examples/common.inc.php' with your OAuth consumer key and secret.

define('OAUTH_CONSUMER_KEY', '###');
define('OAUTH_CONSUMER_SECRET', '###');
define('OAUTH_DOMAIN', '###');
define('OAUTH_APP_ID', '###');

Create OAuth applications in the Yahoo! Developer Dashboard:

http://developer.yahoo.com/dashboard/

Fetching YQL:

See the bundled sample code in examples/yql/delicious.php.

$yql = new YahooYQLQuery();
$response = $yql->execute('select * from delicious.feeds.popular');

if(isset($response->query) && isset($response->query->results))
{
  var_dump($response->query->results);
}
elseif(isset($response->error))
{
  print sprintf('YQL query failed with error: "%s".', $response->error->description);
}
else
{
  print 'YQL response malformed.';
}

Fetching Social Data:

# Yahoo! OAuth Credentials - http://developer.yahoo.com/dashboard/

$CONSUMER_KEY      = '##';
$CONSUMER_SECRET   = '##';
$APPLICATION_ID    = '##';
$CALLBACK_URL      = '##';

$oauthapp      = new YahooOAuthApplication($CONSUMER_KEY, $CONSUMER_SECRET, $APPLICATION_ID, $CALLBACK_URL);

# Fetch request token
$request_token = $oauthapp->getRequestToken($CALLBACK_URL);

# Redirect user to authorization url
$redirect_url  = $oauthapp->getAuthorizationUrl($request_token);

# Exchange request token for authorized access token
$access_token  = $oauthapp->getAccessToken($request_token, $_REQUEST['oauth_verifier']);

# update access token
$oauthapp->token = $access_token;

# fetch user profile
$profile = $oauthapp->getProfile();

var_dump($profile);

Inserting Updates

$oauthapp->insertUpdate(array(
   'title' => "cloned the yos-social-php5 SDK on Github",
   'description' => "A PHP5 SDK for YQL",
   'link' => "http://github.com/yahoo/yos-social-php5",
   'imgURL' => 'http://github.com/images/modules/header/logov3.png', 
   'imgWidth' => '100',
   'imgHeight' => '45'
));

Signing with SimpleAuth (OpenID + OAuth):

See the bundled sample code in examples/simpleauth/simpleauth.php.

Fetching people and activities with OpenSocial:

See the bundled sample code in examples/opensocial/profile.php.

Adding a Contact:

# valid 'Yahoo! Contacts Read/Write' scopes are required to support this method. 

$contact_fields = array();
$contact_fields[] = array('type' => 'email', 'value' => '[email protected]');
$contact_fields[] = array('type' => 'name', 'value' => array('givenName'=> 'John', 'familyName' => 'Doe'));
$contact = array('fields' => $contact_fields);

var_dump($oauthapp->addContact($contact));

Tests

The Yahoo! PHP SDK comes with a test suite to validate functionality. The tests also show functional examples and results. To run the test suite, simply execute the test suite:

php phpunit test/AllTests.php

yos-social-php5's People

Contributors

chirags avatar drewfish avatar dustinwhittle avatar itoto avatar zagraves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yos-social-php5's Issues

token rejected

object(YahooOAuthAccessToken)#8 (7) { ["key"]=> NULL ["secret"]=> NULL ["expires_in"]=> NULL ["session_handle"]=> NULL ["authorization_expires_in"]=> NULL ["yahoo_guid"]=> NULL ["oauth_problem"]=> string(14) "token_rejected" } bool(false)

my error_log also contains fetching from error => YahooCurl.class.php ! may i know specific reason and i need move the application to production.

reply with some solution

php sdk

this seems deprecated

require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';

tried this
require_once 'PHPUnit/Framework/MockObject/Autoload.php';

which gives me
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in ...

Can't get examples/yql/delicious.php to work

My development environment is XAMPP in windows. I am trying to test delicious.php in my machine.

I am getting error in common.inc.php file:
Warning: session_start(): open(/tmp/\sess_4ioppa56l1sdtism0cmadosut5, O_RDWR) failed: No such file or directory (2) in C:\Users\euwernNew\Desktop\Local\xampp\htdocs\YahooSocialSDK\examples\common.inc.php on line 55

I only added the required key to common.inc.php file
define('OAUTH_CONSUMER_KEY', 'YAHOO_CONSUMER_KEY');
define('OAUTH_CONSUMER_SECRET', 'YAHOO_SECRET_KEY');
define('OAUTH_DOMAIN', 'localhost');
define('OAUTH_APP_ID', 'YAHOO_APP_ID');

Am I missing anything?

Please advise.

simpleauth is not working

Sorry! There is an error with the request we received from the website you are trying to use. Please try again in a few minutes. If this error persists please contact the site administrator. Learn more..

am getting the above error on the popup page.

let me where am going wrong.

Simpleauth doesn't work

While testing the simpleauth example provided, I always receive the error: Undefined index: openid_oauth_request_token in /simpleauth/simpleauth.php on line 62, resulting in a oauth_problem=parameter_absent.

How to get the authorized user email address

Dear,

I am unable to get the email address from getProfile() method.
I have tried the getContacts() method but when it comes for new yahoo user it returns empty.
Is there any another way to do that?

Thanks

How to fetch private data through YQL?

How I can fetch private data through YQL with YahooYQLQuery class and execute()? As in the example, it only show fetching public data. The error that I received while fetching data is:

YQL query failed with error: "Authentication Error. The table social.contacts requires a higher security level than is provided, you provided ANY but at least USER is expected".

Thank you.

getSocialGraph parameters unused

offset and limit are not used in the method. the method should accept an offset and limit but set their default values to 0,9999

Curl Timeout Issue

The curl timeout was causing my script to just not return data and return no errors. If anyone else can't work out why they're getting no data back then first check your error_log and second increase the curl tiimeouts in: /yahoo/yos-social-php5/blob/master/lib/Yahoo/YahooCurl.class.php on line 65 and 66.

Wrong option for CURLOPT_SSL_VERIFYHOST in YahooCurl.class.php

In YahooCurl.class.php line 122 there is this code:

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);

However, CURLOPT_SSL_VERIFYHOST is actually a numeric option, not boolean, and value of 1 is deprecated by curl and produces error message in modern PHP version. The correct value should be 0 or 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.