Post Data to Web

BlitzMax Forums/BlitzMax Beginners Area/Post Data to Web

GameScrubs(Posted 2006) [#1]
Is there a way to post data to a website with Max without it being URL Variables?

I did a search on this site and found a way to do it through url but I'm not sure about form data.

Thx

RAFF


FlameDuck(Posted 2006) [#2]
I don't think BlitzMax supports HTTP POST. You can always use HTTP GET tho'.


Perturbatio(Posted 2006) [#3]
I'm not 100% sure how you would do it in BMax, but you do need to pass the header:

multipart/form-data; boundary=--------<Unique Boundary Code>

The <Unique Boundary Code> can be generated from the current date for instance. (remove <>)


GameScrubs(Posted 2006) [#4]
That sucks I would like to submitt an xml file to my website which can be too long to be a url variable.


Chris C(Posted 2006) [#5]
send this to port 80
	POST /login.php HTTP/1.1
	Host: www.mysite.com
	User-Agent: Mozilla/4.0
	Content-Length: 27
	Content-Type: application/x-www-form-urlencoded

	userid=joe&password=guessme

to do POSTing as for sending a file, theres a number of methods you can use
but you could try application/octet-stream


Tom Darby(Posted 2006) [#6]
...if you want to get really in-depth on the subject of what to send to an HTTP server (and what to expect in response), check out RFC 2616 -- section 14 may be of particular interest.

http://www.faqs.org/rfcs/rfc2616.html


GameScrubs(Posted 2006) [#7]
Thanks Chris and Tom I'll give that a try, Got some reading to do.


GameScrubs(Posted 2006) [#8]
Oh boy I can't believe I didn't see this

http://www.blitzmax.com/codearcs/codearcs.php?code=1579

Hopefully it works


Chris C(Posted 2006) [#9]
LOL never underestimate the power of blitzmax.com Luke

CUT

that was THE DARKSIDE

Luke, Luke use the SOURCE (code)


GameScrubs(Posted 2006) [#10]
HAHA and it worked

Thx all


orgos(Posted 2006) [#11]
That is really good.

Thansk.


ghislain(Posted 2006) [#12]
how about saving/attaching a cookie to a web-post? can it be done? and if so: how?

ghislain


GameScrubs(Posted 2006) [#13]
run that code from that link I posted. If you look at the return if you hit a page that has a cookie it will have a field in there that says set cookie. Just parse that data and store it in a variable. Now to hit another page, you are going to have to modify the code to reinsert those set cookie fields with the ones saved on the variable.

Try that out it should work.

-RAFF


Tom Darby(Posted 2006) [#14]
All a cookie is is client-side information storage. Save whatever "cookie" info you want in an ordinary preferences file.


AlexZ(Posted 2007) [#15]
I've got a question, can you use HTTPS with the above code/other post? What encrypts and decrypts my data?