original_string: public function downloadTorrent($id, $path = '')
  	{
  		$request  = $this->sendRequest($this->baseUrl."/torrents/download/".$id, null, 0);
  		$response = json_decode($request['body'], true);
  
  		if (NULL === $response)
  		{
  			preg_match('/filename="(.*?)"/i', $request['header'], $filename);
  
  			$file = fopen($path.'/'.$filename[1], 'w+');
  			fwrite($file, $request['body']);
  			fclose($file);
  		} else {
  			if (array_key_exists('error', $response))
  			{
  				if ($response['code'] == 201 || $response['code'] == 202) {
  					$this->connect();
  					return $this->downloadTorrent($id, $path);
  				}
  				throw new \Exception('Erreur '.$response['code'].' : '.$response['error']);
  			}
  		}
  	}
code: public function downloadTorrent($id, $path = '')
  	{
  		$request  = $this->sendRequest($this->baseUrl."/torrents/download/".$id, null, 0);
  		$response = json_decode($request['body'], true);
  
  		if (NULL === $response)
  		{
  			preg_match('/filename="(.*?)"/i', $request['header'], $filename);
  
  			$file = fopen($path.'/'.$filename[1], 'w+');
  			fwrite($file, $request['body']);
  			fclose($file);
  		} else {
  			if (array_key_exists('error', $response))
  			{
  				if ($response['code'] == 201 || $response['code'] == 202) {
  					$this->connect();
  					return $this->downloadTorrent($id, $path);
  				}
  				throw new \Exception('Erreur '.$response['code'].' : '.$response['error']);
  			}
  		}
  	}
code_tokens: public function downloadTorrent ( $ id , $ path = '' ) { $ request = $ this -> sendRequest ( $ this -> baseUrl . "/torrents/download/" . $ id , null , 0 ) ; $ response = json_decode ( $ request [ 'body' ] , true ) ; if ( NULL === $ response ) { preg_match ( '/filename="(.*?)"/i' , $ request [ 'header' ] , $ filename ) ; $ file = fopen ( $ path . '/' . $ filename [ 1 ] , 'w+' ) ; fwrite ( $ file , $ request [ 'body' ] ) ; fclose ( $ file ) ; } else { if ( array_key_exists ( 'error' , $ response ) ) { if ( $ response [ 'code' ] == 201 || $ response [ 'code' ] == 202 ) { $ this -> connect ( ) ; return $ this -> downloadTorrent ( $ id , $ path ) ; } throw new \ Exception ( 'Erreur ' . $ response [ 'code' ] . ' : ' . $ response [ 'error' ] ) ; } } }
docstring: Download the .torrent from ID
  
  @param string $id   The id of the torrent to download
  @param string $path The path to save the .torrent
docstring_tokens: Download the . torrent from ID