can not, you have to fly in, get all the documents and go marry at the khet, than go apply for the marriage visa. (not easy, you will need a document to say you are single from your own country, police check, copies of everything translated and stamp by mfa, than go to your khet.) it is a nightmare, lots of paper work.
It depends on your luck, sometimes you will meet a angry one and he or she can refuse to let you in. some might ask you to show a return ticket or hotel booking or if you got
*****
b cash. some will ask, if you are working in thailand etc etc....