3

So far, I've only seen examples of using xbuf_frurl() with HTTP_GET method. Does this function in g-wan support HTTP_POST? If it does, how do I pass in the POST data?

Thanks.

Gil
  • 3,279
  • 1
  • 15
  • 25
Andy Tam
  • 31
  • 1

2 Answers2

0

I think you'll need the curl library for this kind of request (look at http://gwan.com/developers libraries part)

http://curl.haxx.se/libcurl/c/

and here the g-wan sample

http://gwan.com/source/curl.c

solisoft
  • 669
  • 4
  • 12
0

The xbuf_frurl() G-WAN API call can be used with HTTP_POST when providing x-www-form-urlencoded parameters:

xbuf_frurl(xbuf, "gwan.com", 80, HTTP_POST, "/?form", 1000, "&arg1=123&arg2=456");

BTW, the next release brings an HTTPS flag to use SSL:

xbuf_frurl(xbuf, "gwan.com", 443, HTTPS | HTTP_POST, "/?form", 1000, "&arg1=123&arg2=456");

Both calls are more concise than libcURL, and doing it in a "less verbose" way (than one line of code) seems unlikely.

Hope it helps.

Gil
  • 3,279
  • 1
  • 15
  • 25