0
我在C#中調用CURL來檢索數據。如何從CURL.exe中檢索數據?
以下是我的代碼:
Process p = new Process();
p.StartInfo.WorkingDirectory = @"D:\";
p.StartInfo.FileName = @"D:\curl.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = "-u agentemail:password -k https://fantasia.zendesk.com/api/v1/tickets/1.xml";
p.Start();
p.WaitForExit();
但問題是捲曲獲取URL數據之後,我該如何取回來自卷邊的數據? 是否有一個命令將數據拉入如下的字符串中?
string x = p.OutputDataReceived();
或
p.OutputDataReceived(string x);
非常感謝你。
[捕捉與C#NSLOOKUP殼輸出(可能重複http://stackoverflow.com/questions/353601/capturing-nslookup-shell -out-with-c-sharp) – RedFilter 2012-03-15 11:04:12
您是否考慮過使用[WebClient](http://msdn.microsoft.com/zh-cn/library/system.net.webclient.aspx)或[HttpWebRequest](http: /msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx)而不是執行外部進程來發出HTTP請求? – dtb 2012-03-15 11:06:00
[讀取來自CURL.exe程序的響應]的可能的重複(http://stackoverflow.com/questions/9706162/read-response-from-curl-exe-program) – dtb 2012-03-15 11:06:57