$filePath, 'expiration' => $expiration); $resp = $this->getOptimalUrls($params); $url = (string)$resp->Download->DownloadURL; // download the file $this->_httpClient->resetParameters(); $this->_httpClient->setUri($url); $resp = $this->_httpClient->request(Zend_Http_Client::GET); return $resp->getBody(); } /** * Convenience function to put the contents of a string into * the Nirvanix IMFS. Analog to PHP's file_put_contents(). * * @param string $filePath Remote path and filename * @param integer $data Data to store in the file * @param string $mimeType Mime type of data * @return Zend_Service_Nirvanix_Response */ public function putContents($filePath, $data, $mimeType = null) { // get storage node for upload $params = array('sizeBytes' => strlen($data)); $resp = $this->getStorageNode($params); $host = (string)$resp->GetStorageNode->UploadHost; $uploadToken = (string)$resp->GetStorageNode->UploadToken; // http upload data into remote file $this->_httpClient->resetParameters(); $this->_httpClient->setUri("http://{$host}/Upload.ashx"); $this->_httpClient->setParameterPost('uploadToken', $uploadToken); $this->_httpClient->setParameterPost('destFolderPath', str_replace('\\', '/',dirname($filePath))); $this->_httpClient->setFileUpload(basename($filePath), 'uploadFile', $data, $mimeType); $response = $this->_httpClient->request(Zend_Http_Client::POST); return new Zend_Service_Nirvanix_Response($response->getBody()); } /** * Convenience function to remove a file from the Nirvanix IMFS. * Analog to PHP's unlink(). * * @param string $filePath Remove path and filename * @return Zend_Service_Nirvanix_Response */ public function unlink($filePath) { $params = array('filePath' => $filePath); return $this->deleteFiles($params); } }