[PD] https get in Pd

Roman Haefeli reduzent at gmail.com
Wed May 22 14:50:52 CEST 2019



On Wed, 2019-05-22 at 13:55 +0200, Nicolas Montgermont wrote:
> Hello everyone,
> 
> What is the easiest way to get the content of a https webpage in pd,
> for example this one:
> https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT
> Is there any patch that can do this around?
> 
> It doesn't seem to work when using [httpget] wrapper based on
> [mrpeach/tcpclient] changed to connect on port 443 instead of 80:
> tcpclient: recv: Connection reset by peer (54)

You could actually hack proper a HTTP request with Pd vanilla (you
wouldn't even need [mrpeach/tcpclient], [netsend -b] would probably
suffice), but doing everything through TLS makes things much more
complicated.

I'd rather go with something that implements TLS natively, like
purest_json.

For instance:

[declare -path purest_json]

[sslcheck 0, GET https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT (
|
[rest]

returns a symbol containing data from above URL. You may use some [list
fromsymbol] trickery to do actually something useful with the data.


Roman


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190522/1125f392/attachment.sig>


More information about the Pd-list mailing list