Thread overview | |||||
---|---|---|---|---|---|
|
February 29, 2020 Using std.net.curl | ||||
---|---|---|---|---|
| ||||
I'm working with std.net.curl. Using curl on the command line I can do this: curl -T file.txt http://localhost:9998/tika and it returns text as a result. When I attempt to do the same thing in D code as follows: import std.net.curl; upload("file.txt", "http://localhost:9998/tika"); the text is written to standard out. I want to capture that text in a variable, but the upload function returns void. How can I get the text returned by the web server to be stored in a variable? |
February 29, 2020 Re: Using std.net.curl | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Anderson | On Saturday, 29 February 2020 at 03:53:37 UTC, David Anderson wrote: > I want to capture that text in a variable, but the upload function returns void. How can I get the text returned by the web server to be stored in a variable? import std; auto updata = read("inputfile"); auto dldata = put("https://postman-echo.com/put", updata); writeln(dldata); |
February 29, 2020 Re: Using std.net.curl | ||||
---|---|---|---|---|
| ||||
Posted in reply to Boris Carvajal | On Saturday, 29 February 2020 at 07:35:10 UTC, Boris Carvajal wrote:
> On Saturday, 29 February 2020 at 03:53:37 UTC, David Anderson wrote:
>
>> I want to capture that text in a variable, but the upload function returns void. How can I get the text returned by the web server to be stored in a variable?
>
> import std;
>
> auto updata = read("inputfile");
> auto dldata = put("https://postman-echo.com/put", updata);
> writeln(dldata);
Awesome, thank you! That's exactly what I needed.
|
Copyright © 1999-2021 by the D Language Foundation