Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-26-2009, 07:48 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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(myip80);
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.
Reply With Quote
  #2  
Old 03-26-2009, 07:55 PM
Riot-Starter Riot-Starter is offline
Registered User
Join Date: Aug 2001
Location: Central Florida, USA
Posts: 79
Riot-Starter is on a distinguished road
Send a message via AIM to Riot-Starter
Quote:
Originally Posted by Stefan View Post
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(myip80);
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:50 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.