/** * Gets the HTTP client object. * * @return Horde_Http_Client */ public static function getHttpClient() { if (!self::$_httpClient) { self::$_httpClient = new Horde_Http_Client(); } return self::$_httpClient; }
public function run() { $args = array_merge($this->_args, $this->_config, array('method' => $this->_method)); if (!empty($this->_config['api_secret'])) { $args['api_sig'] = $this->_sign($args); } $client = Horde_Service_Scribd::getHttpClient(); $response = $client->post(Horde_Service_Scribd::ENDPOINT, $args); return new Horde_Service_Scribd_Response($response->getBody()); }
<?php /** * http://www.scribd.com/platform/documentation/api?method_name=Authentication * http://www.scribd.com/platform/account * */ error_reporting(E_ALL); require 'Horde/Autoloader.php'; $scribd = new Horde_Service_Scribd(array('api_key' => '', 'api_secret' => '')); foreach ($scribd->getList() as $doc) { echo $doc->doc_id . ': ' . $doc->title . "\n"; $doc_id = $doc->doc_id(); } var_dump($scribd->getConversionStatus($doc_id)); var_dump($scribd->getSettings($doc_id)); if (false) { /** * Upload a document from a file */ $file = '../testfile.txt'; //a reference to the file in reference to the current working directory. $doc_type = null; $access = null; $rev_id = null; // $data = $scribd->upload($file, $doc_type, $access, $rev_id); // returns Array ( [doc_id] => 1026598 [access_key] => key-23nvikunhtextwmdjm2i ) /** * Upload a document from a URL */ $scribd->my_user_id = '143'; # The user ID of one of your users