KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to pass a GET method using 4D Internet Command (TCP_SEND.
PRODUCT: 4D Internet Commands | VERSION: 2003.2 | PLATFORM: Mac & Win
Published On: February 26, 2004
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

How to send form data to a server using GET method. There are two types of methods; GET and POST. The main differences between the two are the way the data gets passed. When GET is used, the query string is appended to the URL and is passed to the server. The size of the query string is limited to the server/system in which GET is used. On the other the hand, POST request gets read in by STDIN. The server/system reads in the Content-length header to get the numbers of bytes to read. The length is not limited.

Here is an example of how to simulate a GET request using USPS (United States Postal Service) server and 4D as an example.

1. Open a connection to the server using port 80.
Ex. $ERR:=TCP_Open ("Production.ShippingAPIs.com";80;$tcp_ID;0)

2. Build the GET request with a forward slash and the API to use.
Ex $request_String:="GET /ShippingAPI.dll?API=Rate&XML= [the rest of the required request here]"

3. Append the ending header tags (HTTP/1.1 or HTTP/1.0 depending on used) to the request.
Ex. $request_String:= $request_String +"\n"+"HTTP/1.1"

4. Send the request.
Ex. $ERR:=TCP_Send ($tcp_ID; $request_String)