simplePostToHost function

Sends Simple Post Request to HTTP Server (host)

Sends Simple Post Request to HTTP Server (host)

Sends Post Request to HTTP Server

simplePostToHost(host, path, datatosend, referer, contenttype, port=80, maxlen=131063L)

Arguments

  • host: The host to which to send the Request eg.: www.spiegel.de, localhost
  • path: The path to the file eg. /cgi-bin/paramlist.cgi or /index.html
  • datatosend: key value pairs pairs separated by & "pid=14\&pollvotenumber=2\n4"
  • referer: something like www.myhome.org
  • contenttype: default: application/x-www-form-urlencoded
  • port: its 80 or 8080 most frequently
  • maxlen: maximum blocksize read at once

Returns

The document which the server returns as a string.

Details

It is a simple http client. So it does not take care of special chars e.g. whitspaces. For details see e.g. perl HTTP::Request::Common documentation and

http://www.w3.org/Protocols/rfc1341/0_TableOfContents.html

The output is gathered in several blocks, if necessary. The parameter maxlen is used to determine the last data block by its length. The first block with less than maxlen bytes is considered the last one.

Author(s)

E.W.Wolski wolski@molgen.mpg.de, Andreas Westfeld

See Also

getToHost, postToHost

Examples

host <- "api.scb.se" path <- "/OV0104/v1/doris/en/ssd" data <- '{"format":"json"}' simplePostToHost(host, path, data, contenttype="text/json")
  • Maintainer: Andreas Westfeld
  • License: GPL (>= 2)
  • Last published: 2022-04-25

Useful links