Re: std.net.curl and HTTP.responseHeaders

2021-02-04 Thread Vindex via Digitalmars-d-learn
Thank you! For other sites, the first solution somehow worked (I did it following the example from the documentation).

Re: std.net.curl and HTTP.responseHeaders

2021-02-04 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 19:25:18 UTC, Vindex wrote: Output: ``` std.net.curl.HTTPStatusException@/usr/include/dmd/phobos/std/net/curl.d(1097): HTTP request returned status code 405 () ``` Perhaps some special HTTP configuration is needed? Is this closer to what you want? import

Re: std.net.curl : Performance

2020-11-09 Thread Vino via Digitalmars-d-learn
On Monday, 9 November 2020 at 20:57:33 UTC, Daniel Kozak wrote: On Mon, Nov 9, 2020 at 9:50 PM rinfz via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: > On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: >> ... >

Re: std.net.curl : Performance

2020-11-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 9, 2020 at 9:50 PM rinfz via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: > > On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: > >> ... > > > > The only curl option you need to set within the loop is

Re: std.net.curl : Performance

2020-11-09 Thread rinfz via Digitalmars-d-learn
On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: ... The only curl option you need to set within the loop is the CurlOption.url. So your foreach block should look more like: foreach (...) { string url = chain(apihost,

Re: std.net.curl : Performance

2020-11-09 Thread rinfz via Digitalmars-d-learn
On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: ... The only curl option you need to set within the loop is the CurlOption.url. So your foreach block should look more like: foreach (...) { string url = chain(apihost, only(':'), to!string(apiport), apiuri).to!string;

Re: std.net.curl : Performance

2020-11-09 Thread Daniel Kozak via Digitalmars-d-learn
Just delete it On Mon, Nov 9, 2020 at 9:00 PM Vino via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi All, > >Request your help to on how to improve the performance of the > below code. > > import std.conv: to; > import std.net.curl : get, HTTP, CurlOption; > import

Re: std.net.curl get json_encode

2020-10-11 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 11 October 2020 at 08:48:16 UTC, Vino wrote: On Friday, 9 October 2020 at 17:50:16 UTC, Andre Pany wrote: [...] Hi Andre, Thank you very much, now we are able to get the data as expected using jv["Name"], now when we try to print all the returned data with Key and Values as

Re: std.net.curl get json_encode

2020-10-11 Thread Vino via Digitalmars-d-learn
On Friday, 9 October 2020 at 17:50:16 UTC, Andre Pany wrote: On Friday, 9 October 2020 at 05:56:05 UTC, Vino wrote: On Friday, 9 October 2020 at 05:30:34 UTC, ikod wrote: On Friday, 9 October 2020 at 01:45:37 UTC, Vino wrote: On Friday, 2 October 2020 at 23:20:48 UTC, Imperatorn wrote: On

Re: std.net.curl get json_encode

2020-10-09 Thread Andre Pany via Digitalmars-d-learn
On Friday, 9 October 2020 at 05:56:05 UTC, Vino wrote: On Friday, 9 October 2020 at 05:30:34 UTC, ikod wrote: On Friday, 9 October 2020 at 01:45:37 UTC, Vino wrote: On Friday, 2 October 2020 at 23:20:48 UTC, Imperatorn wrote: On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All,

Re: std.net.curl get json_encode

2020-10-09 Thread Vino via Digitalmars-d-learn
On Friday, 9 October 2020 at 05:30:34 UTC, ikod wrote: On Friday, 9 October 2020 at 01:45:37 UTC, Vino wrote: On Friday, 2 October 2020 at 23:20:48 UTC, Imperatorn wrote: On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All, ... auto content = https.perform(); https.shutdown;

Re: std.net.curl get json_encode

2020-10-08 Thread ikod via Digitalmars-d-learn
On Friday, 9 October 2020 at 01:45:37 UTC, Vino wrote: On Friday, 2 October 2020 at 23:20:48 UTC, Imperatorn wrote: On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All, ... auto content = https.perform(); https.shutdown; JSONValue jv = parseJSONValue(content); Maybe JSONValue jv

Re: std.net.curl get json_encode

2020-10-08 Thread Vino via Digitalmars-d-learn
On Friday, 2 October 2020 at 23:20:48 UTC, Imperatorn wrote: On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All, Request your help, the below code is working but we need the output as a json array, in PHP we have json_encode(content), so how to do the same in D, the output is

Re: std.net.curl get json_encode

2020-10-02 Thread Imperatorn via Digitalmars-d-learn
On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All, Request your help, the below code is working but we need the output as a json array, in PHP we have json_encode(content), so how to do the same in D, the output is as below, as we need to store this output into database table

Re: std.net.curl get json_encode

2020-10-02 Thread Imperatorn via Digitalmars-d-learn
On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All, Request your help, the below code is working but we need the output as a json array, in PHP we have json_encode(content), so how to do the same in D, the output is as below, as we need to store this output into database table

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Saturday, 24 September 2016 at 19:42:11 UTC, Joseph Rushton Wakeling wrote: On Saturday, 24 September 2016 at 19:27:31 UTC, Joseph Rushton Wakeling wrote: Further to earlier remarks: I now think this may be a general problem of LDC 1.0.0 and not a problem of the snap package. I tried

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Saturday, 24 September 2016 at 19:27:31 UTC, Joseph Rushton Wakeling wrote: Further to earlier remarks: I now think this may be a general problem of LDC 1.0.0 and not a problem of the snap package. I tried building my simple curl-using program using an LDC 1.0.0 build and installed from

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Saturday, 24 September 2016 at 19:11:52 UTC, Joseph Rushton Wakeling wrote: On Friday, 23 September 2016 at 00:55:43 UTC, Stefan Koch wrote: This suggests that libcurl is loaded. could you compile with -g ? and then post the output ? Further to earlier remarks: I now think this may be a

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Friday, 23 September 2016 at 00:55:43 UTC, Stefan Koch wrote: This suggests that libcurl is loaded. could you compile with -g ? and then post the output ? Thanks Stefan! It was compiled with -g, but I was missing the libcurl3-dbg package. Here's the results: #0 0x0046b048 in

Re: std.net.curl and libcurl.so

2016-09-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 September 2016 at 23:19:27 UTC, Joseph Rushton Wakeling wrote: The segfault would suggest to me that either the loading of the library fails or that there's some resource phobos expects to find which it can't access. Can anyone advise what could be going on here? -- Joe

Re: std.net.curl

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:13:48 UTC, anonymous wrote: and figured out that the linker is invoked (on my machine) with gcc a.o -o a -m64 -lcurl -L/usr/lib/x86_64-linux-gnu -Xlinker correct (I named the example programm a.d instead of app.d): gcc app.o -o app -m64 -lcurl

Re: std.net.curl

2015-08-17 Thread tired_eyes via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:26:29 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 13:04:31 UTC, tired_eyes wrote: Error: unrecognized switch '-lcurl' ooh I'm sorry, should have been `dmd -L-lcurl yourprogram.d` Yes, it did the trick.

Re: std.net.curl

2015-08-17 Thread tired_eyes via Digitalmars-d-learn
On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that helps. Error: unrecognized switch '-lcurl'

Re: std.net.curl

2015-08-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that helps.

Re: std.net.curl

2015-08-17 Thread yawniek via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:04:31 UTC, tired_eyes wrote: On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that

Re: std.net.curl

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that helps. DMD does not accept -lcurl. From dmd --help:

Re: std.net.curl

2015-08-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:04:31 UTC, tired_eyes wrote: Error: unrecognized switch '-lcurl' ooh I'm sorry, should have been `dmd -L-lcurl yourprogram.d`

Re: [std.net.curl] Downloading multiple files using download()

2014-12-28 Thread Jack via Digitalmars-d-learn
On Sunday, 28 December 2014 at 07:52:24 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 28 Dec 2014 07:44:33 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: How does one compile for Windows on a Linux Machine using dub? I've been using the platform : [windows]

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 06:14:09 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I'm trying to create a sort of downloader where it will download multiple pages of comics which are in .jpg format. Now the problem is, that when I used the download() function:

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread Jack via Digitalmars-d-learn
On Sunday, 28 December 2014 at 06:26:18 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 28 Dec 2014 06:14:09 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I'm trying to create a sort of downloader where it will download multiple pages of comics which are in

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 06:51:14 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: As much as my brotherhood senses push me into revealing the links(they're in json), doing that will reveal my guilty pleasures and fetishes. Well, anywho, thanks for that. I appreciate

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread Jack via Digitalmars-d-learn
On Sunday, 28 December 2014 at 06:59:02 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 28 Dec 2014 06:51:14 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: As much as my brotherhood senses push me into revealing the links(they're in json), doing that will

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 07:24:53 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Well it's not really that much of a link really. I swear. It's just like fapping to drawings or some sort of thing. Not really THAT good of a comic. *sweats* so that's not one of that

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread Jack via Digitalmars-d-learn
On Sunday, 28 December 2014 at 07:33:23 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 28 Dec 2014 07:24:53 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Well it's not really that much of a link really. I swear. It's just like fapping to drawings or some

Re: [std.net.curl] Downloading multiple files using download()

2014-12-27 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 07:44:33 + Jack via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: How does one compile for Windows on a Linux Machine using dub? I've been using the platform : [windows] configuration in my dub.json to no avail since my Windows installation keeps on

Re: std.net.curl - get() is too slow

2013-12-20 Thread Brad Anderson
On Friday, 20 December 2013 at 18:23:30 UTC, Benji wrote: When I call get() function from std.net.curl, I notice it's extremely slow! Maybe 50 times slower than in Python.. Is there any better/faster alternative? Without doing any profiling I'd say this character concatenation while decoding

Re: std.net.curl - get() is too slow

2013-12-20 Thread David Nadlinger
On Friday, 20 December 2013 at 18:23:30 UTC, Benji wrote: When I call get() function from std.net.curl, I notice it's extremely slow! Maybe 50 times slower than in Python.. Is there any better/faster alternative? How do you benchmark the functions? David

Re: std.net.curl on Windows

2013-08-09 Thread David
Is there an easier way? How to learn about it? A detailed instruction (at least as detailed as the steps above) at the top of the manual page (http://dlang.org/phobos/std_net_curl.html) would have been nice... After all, it's a third party library not fully supplied with the compiler. Thew

Re: std.net.curl on Windows

2013-08-09 Thread Ivan Kazmenko
On Friday, 9 August 2013 at 10:26:05 UTC, David wrote: Is there an easier way? How to learn about it? A detailed instruction (at least as detailed as the steps above) at the top of the manual page (http://dlang.org/phobos/std_net_curl.html) would have been nice... After all, it's a third

Re: std.net.curl is not working?

2013-04-26 Thread qznc
Fri, 26 Apr 2013 19:25:16 +0200: mab wrote Why i get the following Error, when i try to compile a simple Hello World that imports std.net.curl= The Error: # dmd hello.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor28FZv':

Re: std.net.curl is not working?

2013-04-26 Thread ollie
On Fri, 26 Apr 2013 19:25:16 +0200, mab wrote: undefined reference to `curl_global_init' undefined reference to `curl_global_cleanup' These functions are defined in libcurl. Make sure you have installed libcurl if it wasn't installed as a dependency for curl.

Re: std.net.curl is not working?

2013-04-26 Thread mab
Thank you for answering. But it didnt work. I get: #dmd hello.d -L-lcurl /usr/bin/ld: cannot find -lcurl collect2: ld returned 1 exit status --- errorlevel 1 Curl is installed, as also libcurl3. I forget to mention that i am using DMD64 D Compiler v2.062. Is std.net.curl working in this

Re: std.net.curl is not working?

2013-04-26 Thread Jordi Sayol
On 26/04/13 19:55, mab wrote: Thank you for answering. But it didnt work. I get: #dmd hello.d -L-lcurl /usr/bin/ld: cannot find -lcurl collect2: ld returned 1 exit status --- errorlevel 1 Curl is installed, as also libcurl3. You need to install the development curl package: $ sudo

Re: std.net.curl is not working?

2013-04-26 Thread Ali Çehreli
On 04/26/2013 10:55 AM, mab wrote: Thank you for answering. But it didnt work. I get: #dmd hello.d -L-lcurl /usr/bin/ld: cannot find -lcurl Try providing the directory that the curl library file is in: #dmd hello.d -L-L/wherever/libcurl/is/in -L-lcurl Ali

Re: std.net.curl is not working?

2013-04-26 Thread John Colvin
On Friday, 26 April 2013 at 17:55:59 UTC, mab wrote: Thank you for answering. But it didnt work. I get: #dmd hello.d -L-lcurl /usr/bin/ld: cannot find -lcurl collect2: ld returned 1 exit status --- errorlevel 1 Curl is installed, as also libcurl3. I forget to mention that i am using DMD64 D

Re: std.net.curl is not working?

2013-04-26 Thread mab
On Friday, 26 April 2013 at 18:14:04 UTC, Jordi Sayol wrote: [...] You need to install the development curl package: $ sudo apt-get install libcurl4-openssl-dev or $ sudo apt-get install libcurl4-gnutls-dev or $ sudo apt-get install libcurl4-nss-dev [...] That´s it. Thank you!

Re: std.net.curl - how to set custom Content-Type?

2012-09-18 Thread Johannes Pfau
Am Mon, 17 Sep 2012 22:35:39 +0200 schrieb Jonathan M Davis jmdavisp...@gmx.com: On Monday, September 17, 2012 20:59:05 Johannes Pfau wrote: addRequestHeader is quite dumb. It simply appends the header to a list. So by just calling it again you would actually send 2 Content-Type headers.

Re: std.net.curl - how to set custom Content-Type?

2012-09-18 Thread Dmitry Olshansky
On 18-Sep-12 11:41, Johannes Pfau wrote: Am Mon, 17 Sep 2012 22:35:39 +0200 schrieb Jonathan M Davis jmdavisp...@gmx.com: On Monday, September 17, 2012 20:59:05 Johannes Pfau wrote: addRequestHeader is quite dumb. It simply appends the header to a list. So by just calling it again you would

Re: std.net.curl - how to set custom Content-Type?

2012-09-17 Thread Johannes Pfau
Am Mon, 17 Sep 2012 22:33:28 +0400 schrieb Dmitry Olshansky dmitry.o...@gmail.com: Recently was playing around with std.net.curl high-level API. One thing that is a blocker for me is (quoting the docs): @property void postData(const(char)[] data); Specifying data to post when not using

Re: std.net.curl - how to set custom Content-Type?

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 20:59:05 Johannes Pfau wrote: addRequestHeader is quite dumb. It simply appends the header to a list. So by just calling it again you would actually send 2 Content-Type headers. So, you're suggesting to send 2 content headers? That can't be good. It might work,

Re: std.net.curl get webpage asia font issue

2012-06-08 Thread Dmitry Olshansky
On 08.06.2012 5:03, Sam Hu wrote: On Thursday, 7 June 2012 at 10:43:32 UTC, Dmitry Olshansky wrote: string content = get(dlang.org); It's simple this line you convert whatever site content was to unicode. Problem is that convert is either broken or it's simply a cast whereas it should

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Kevin
On 07/06/12 02:57, Sam Hu wrote: string content = get(dlang.org); writefln(%s\n,content); So my very simple question is how to retrieve information from a webpage which could possibily contains asia font (like Chinese font)? I'm not really sure but try: wstring content = get(dlang.org);

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Dmitry Olshansky
On 07.06.2012 10:57, Sam Hu wrote: Greeting! The document on this website provide an example on how to get webpage information by std.net.curl.It is quite straightforward: [code] import std.net.curl, std.stdio; void main(){ // Return a string containing the content specified by an URL string

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Sam Hu
On Thursday, 7 June 2012 at 10:43:32 UTC, Dmitry Olshansky wrote: string content = get(dlang.org); It's simple this line you convert whatever site content was to unicode. Problem is that convert is either broken or it's simply a cast whereas it should re-encode source as unicode. So the way

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Sam Hu
On Thursday, 7 June 2012 at 10:38:53 UTC, Kevin wrote: On 07/06/12 02:57, Sam Hu wrote: string content = get(dlang.org); writefln(%s\n,content); So my very simple question is how to retrieve information from a webpage which could possibily contains asia font (like Chinese font)? I'm not

Re: std.net.curl not working in 2.058 for Windows

2012-02-24 Thread Brad Anderson
On Friday, 24 February 2012 at 07:59:50 UTC, Brad Anderson wrote: There is no documentation (both on dlang.org and in the local documentation) so I'm not sure if it's supposed to be working yet. I get linker errors when I try to use it: $ dmd netcurl.d OPTLINK (R) for Win32 Release

Re: std.net.curl not working in 2.058 for Windows

2012-02-24 Thread Brad Anderson
On Friday, 24 February 2012 at 08:47:14 UTC, Brad Anderson wrote: On Friday, 24 February 2012 at 07:59:50 UTC, Brad Anderson wrote: There is no documentation (both on dlang.org and in the local documentation) so I'm not sure if it's supposed to be working yet. I get linker errors when I try