Post Requests
BlitzMax Forums/BlitzMax Beginners Area/Post Requests
| ||
I've been trying to send http post requests to an ASP page using the code here: http://www.blitzmax.com/codearcs/codearcs.php?code=1932 The requests contain no files, only form data added with the addinput method I am getting 400 Bad Request, which would seem to point to a problem constructing the requests My question is, firstly, has anything changed in Blitz that would stop this code from working in the 2 years since it was released? and secondly, am I meant to be doing something else other than the .send method to send a post request with no file attached? if the answer to these is both no, then I'll go ask on an ASP forum and see if something is wrong there |
| ||
Well, I got it going Using Multipart Form Data is bad for just text, and putting the hostname in the first line of the request is unnecessary To anyone else attempting this, I suggest using application/x-www-form-urlencoded instead, cut out all the crap about boundries, and construct the message body as you would a query string for use with GET |
| ||
I'll stick with libcurl thanks :-) That way I don't need to know anything about anything... (which is just how I like to code...) |
| ||
the HOST header *is* necessary if the website in question is sharing an IP address with multiple websites, as is the case on the majority of shared hosting servers... Skipping it may work in your situation, but will cause it to fail on most others. |
| ||
That way I don't need to know anything about anything... (which is just how I like to code...) Hmm, you must have gone to the same college I went to. That's exactly what they taught us. |