[PD] how to do a http request from pd to a webserver and get the results

Marc Boon marcboon at dds.nl
Sun Mar 6 13:53:30 CET 2005


Roman Haefeli wrote:
> hi
> 
> [netclient] from maxlib (
> http://www.akustische-kunst.org/puredata/maxlib/ )works in both ways,
> sending data to server and receive data from it.
> i tried the same thing and it worked technically, but instead of getting
> the index.html-file i always got a html-file with an error-msg like 'bad
> request'.
> i don't know much about the http-protocol, but it seems you have to send
> a quite accurately 'formulated' request to get the data you want. may
> you try to connect from your brwoser to [netserver] (also from maxlib)
> in order to see how such a request-msg looks like.
> i always failed, but you may will be luckier than me. if so, let me
> know.

I ended up using [shell], sending it the name of a shell script as a message.
The shell script first calls wget to do the actual http request, and then does 
some testing on the return value before sending the response to stdout, which is 
then picked up by [shell] again.

This way, I can put the various wget options in this external shell script, and 
do all my error checking before sending the result back to pd. Makes it more 
flexible and robust. It also allows me to easily test (and modify) my http 
access script outside of pd.

Thanks for all your input!
m at rc





More information about the Pd-list mailing list