BE_HTTP_POST

BE_HTTP_POST


Does a http POST function and returns the results. This uses the curl library so output will be similar to that. This is used in conjunction with the BE_HTTP_SetCustomHeader function to set custom headers in advance and the BE_HTTP_ResponseCode and BE_HTTP_ResponseHeaders functions to get the result values after the POST is complete.

Parameters:

- url : the url to retrieve.

- parameters : The datato send to the url. This is a text string, which is a list of all of the parameters to send in name value pair format. Put an "=" between the name and value, and an ampersand "&" between each pair. Use file=@path for external files.

- username : username for HTTP authentication

- password : password for HTTP authentication

Keywords:

HTTP POST


Version History:

- 1.3 :

- 2.0 : Added optional username and password parameters.

- 3.1 : Allowed the use of file=@path for file parameters. ( OS Path, not FileMaker path ).

- 4.0 : Added the optional filename parameter.

Notes:

- UseBE_CurlSetOption ( "CURLOPT_HTTPAUTH" ; type) to set authentication types.

- Check for errors using theBE_GetLastErrorfunction and use https://curl.haxx.se/libcurl/c/libcurl-errors.html for error details.

Code Examples:

BE_HTTP_POST ( $url ; "image=@/Users/nick/Desktop/test.jpg" )


BE_HTTP_POST ( "http://Fictional.Server.com/service.js" ; 
	"{\"method\" : \"Workgroup.projects.listActive\", \"args\" : []}" ;	"Administrator" ; "password123")


BE_HTTP_SetCustomHeader ( "Content-type"; "multipart/mixed" )
You can also do mulipart/form data

BE_HTTP_POST ( TestScriptURL ; "a=b&c=d&image=@" & TemporaryFile ( Test::File ; false ) ; "frooble" ; "knobwhart" )


Still need help? Contact Us Contact Us