Quote:
Originally Posted by Stefan
I think using TSocket is simplier, since the command would need to handle authentication, severel parameters etc.
This is a GET request with authentication:
PHP Code:
temp.socket = new TSocket("MySocket"); temp.socket.connect(myip, 80); temp.delim = char(13) @ char(10); temp.socket.send("Get /index.php?test=123" @ temp.delim); temp.socket.send("Authorization: Basic " @ base64encode("username:password") @ temp.delim); temp.socket.send(temp.delim); waitfor(temp.socket, "onClose", 10); temp.answer = temp.socket.data.tokenize('\n');
The URL encoding is already done in the engine, can add a function to use it by script (urlencode)
Update: added urlencode(url) on Kingdoms, can upload a version for hosted servers end of the week along with the recent /scripthelp improvements.
|
I suppose it is rather simple, as I said I've never used TSocket, being as I haven't attempted to do any graalserver -> webserver communication since GS2 was rather new, and no server I have access too has TSocket enabled. I still don't particularly like the idea of having to request it to be enabled to use it for something like this though.