Last active
December 12, 2015 10:38
-
-
Save daviddesberg/4760647 to your computer and use it in GitHub Desktop.
Creating a Twitter OAuth1 Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use OAuth\ServiceFactory; | |
use OAuth\Common\Storage\Session; | |
use OAuth\Common\Consumer\Credentials; | |
// create a factory | |
// optional constructor argument defines the type of http client to use for the services this factory creates | |
$factory = new ServiceFactory(); | |
// tokenstorageinterface implementation | |
$storage = new Session(); | |
// Setup the credentials for the requests | |
$credentials = new Credentials( | |
'id', | |
'secret_key', | |
'http://yoursite.com/oauth-client', | |
); | |
// Instantiate the twitter service using the above credentials and storage provider | |
$twitterService = $serviceFactory->createService('twitter', $credentials, $storage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment