Create a gist now

Instantly share code, notes, and snippets.

oauth uploader sample
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
//$uploader = Services_OAuthUploader::factory('twitpic', $this->oauth, 'apiKey');
//$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) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment