Execute CURL Command using C#

 First create your command in any variable..
  1. -T "d:\myfile.txt" ftp://username:[email protected] -k --ftp-ssl  
Create a method which execute this command on the server. 
  1. Process commandProcess = null;   
  2.   
  3.   
  4. public bool ExecuteCommand(string curlExePath, string commandLineArguments, bool isReturn = true)    
  5. {    
  6.     bool result = true;    
  7.     try    
  8.     {    
  9.         commandProcess = new Process();    
  10.         commandProcess.StartInfo.UseShellExecute = false;    
  11.         commandProcess.StartInfo.FileName = curlExePath; // this is the path of curl where it is installed;    
  12.         commandProcess.StartInfo.Arguments = commandLineArguments; // your curl command    
  13.         commandProcess.StartInfo.CreateNoWindow = true;    
  14.         commandProcess.StartInfo.RedirectStandardInput = true;    
  15.         commandProcess.StartInfo.RedirectStandardOutput = true;    
  16.         commandProcess.StartInfo.RedirectStandardError = true;    
  17.         commandProcess.Start();    
  18.         var reader = new ProcessOutputReader(commandProcess);    
  19.         reader.ReadProcessOutput();    
  20.         commandProcess.WaitForExit();    
  21.         string output = reader.StandardOutput;    
  22.         lastStandardOutput = output;    
  23.         string error = reader.StandardError;    
  24.         commandProcess.Close();    
  25.     }    
  26.     catch(exception ex)    
  27.     {    
  28.     }    
  29. }