Archived Forum Post

Index of archived forum posts

Question:

Post variables on Download request?

Oct 30 '14 at 22:42

Is it possible to post variables on a download request using CkHttp_Download?

I have made a php page which returns an image. This works fine, but i need to modify the image based off of user input... I would prefer to use POST instead of GET. Any ideas?


Answer

The need for POST instead of GET is typically when the HTTP request body contains data, such as an XML document, a JSON document, etc, or if it contains parameters that are lengthy and/or numerous. If you have a few parameters (variables), such as name=bob and value=22, then just put them in the URL for the GET. For example:

http://www.chilkatsoft.com/myDownload.zip?name=bob&value=22

The params in the URL need to be URL encoded. To construct that part of the string, you could use the Chilkat.HttpRequest object, call AddParam for each param, and then get the URL encoded param string via the GetUrlEncodedParams method.