Re: library(http/http_client) with https URLs
Michael Hendricks <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFHuXuZAwQJCNHRsC1xmLHKLy0EwjSY8SaNQ-SDVCSyDkhuOvw@mail.gmail.com> |
On Thu, Jul 18, 2013 at 7:15 AM, Jan Wielemaker <[email protected]> wrote: > Assuming you have the data you want to post in Prolog, it is quite > likely that http_open/3 can do a better job. Thanks. I was definitely missing something obvious. I'm embarrassed to admit that I had read the http_open/3 docs a dozen times and not noticed the post(Data) option. It's even referenced from the method(Method) option ;-) For the mailing list archives, here's my original, curl hack: process_create(path(curl), ['--silent', '-d', 'q=hello', ' https://encrypted.google.com'], [stdout(pipe(Out))]), read_stream_to_codes(Out, Codes). Here's a way using http_open/3: use_module(library(http/http_open), [http_open/3]), use_module(library(http/http_ssl_plugin)), % activate https support use_module(library(http/http_header)). % activate POST support http_open('https://encrypted.google.com', Stream, [post(form([q=hello])), status_code(405)]), read_stream_to_codes(Stream, Codes). Jan, thanks for your patience while I got my act together :-) -- Michael -------------- next part -------------- HTML attachment scrubbed and removed