/** * Tests the building of the remote upload */ public function testBuildRemoteUpload() { $data = json_decode($this->fixtureUpload, true); $upload = RemoteUploadBuilder::buildRemoteUpload($data); $this->assertInstanceOf('Ideneal\\OpenLoad\\Entity\\RemoteUpload', $upload); }
/** * Uploads a remote file * * @param string $url The remote file url * @param string|Folder $folder The folder id * @param array $headers The request headers * * @return RemoteUpload */ public function uploadRemoteFile($url, $folder = null, array $headers = array()) { $params = $this->getAuthParams(); $params['url'] = $url; if ($folder) { $params['folder'] = (string) $folder; } foreach ($headers as $name => $header) { $params['headers'] .= $name . ": " . $header . "\n"; } $response = $this->processRequest('remotedl/add', $params); $result = $this->processResponse($response); return RemoteUploadBuilder::buildRemoteUpload($result); }