simple & easy post OAuth Echo Upload services.
support upload service
sample code
https://gist.github.com/748086
<?php
require_once "Services/Twitter/Uploader.php";
$oauth = new HTTP_OAuth_Consumer('APP KEY', 'APP SECRET', 'TOKEN', 'SECRET');
$uploader = Services_Twitter_Uploader::factory('yfrog', $oauth);
//twitpic require api key http://dev.twitpic.com/apps/new
//$uploader = Services_Twitter_Uploader::factory('twitpic', $this->oauth, 'apiKey');
//proxy
//$req = new HTTP_Request2();
//$req->setConfig(array( 'proxy_host' => 'HOST', 'proxy_port' => 'PORT'));
//$uploader = Services_Twitter_Uploader::factory('yfrog', $oauth, null, $req);
try {
$url = $uploader->upload('/path/to/upload.jpg', 'from Services_OAuthUploader');
var_dump($url); // upload URL
} catch(Twitter_Uploader_Exception $e) {
var_dump($e);
}
?>
links
|