Created
December 20, 2010 06:26
-
-
Save withgod/748086 to your computer and use it in GitHub Desktop.
oauth uploader sample
This file contains 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 | |
require_once "Services/OAuthUploader.php"; | |
$oauth = new HTTP_OAuth_Consumer('APP KEY', 'APP SECRET', 'TOKEN', 'SECRET'); | |
$uploader = Services_OAuthUploader::factory('yfrog', $oauth); | |
//twitpic require api key http://dev.twitpic.com/apps/new | |
//$uploader = Services_OAuthUploader::factory('twitpic', $this->oauth, 'apiKey'); | |
//proxy | |
//$req = new HTTP_Request2(); | |
//$req->setConfig(array( 'proxy_host' => 'HOST', 'proxy_port' => 'PORT')); | |
//$uploader = Services_OAuthUploader::factory('yfrog', $oauth, null, $req); | |
try { | |
$url = $uploader->upload('/path/to/upload.jpg', 'from Services_OAuthUploader'); | |
var_dump($url); // uploaded URL | |
} catch(OAuthUploader_Exception $e) { | |
var_dump($e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment