Getting Information From A Web Server?
by Taylor Suchan · 10/19/2001 (8:05 am) · 3 comments
First I have Created a GUI Object:
Then code pulls from the web site:
(PERL - Runs After SQL Statement)
This reads my news from inside Tribes2
new ShellScrollCtrl() {
profile = "NewScrollCtrlProfile";
horizSizing = "left";
vertSizing = "top";
position = "19 35";
extent = "602 227";
minExtent = "24 52";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
defaultLineHeight = "15";
childMargin = "4 2";
fieldBase = "gui/shll_field";
new GuiScrollContentCtrl(ShifterNewsScroller) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "8 6";
extent = "570 215";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
new GuiMLTextCtrl(ShifterNewsText) {
profile = "GuiMessageEditHudTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "567 3360";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
deniedSound = "InputDeniedSound";
};
};
};Then code pulls from the web site:
(PERL - Runs After SQL Statement)
$art = 0;
while($db->FetchRow() && $art < 15)
{
%Data = $db->DataHash();
$id = $Data{"Col001"};
$date = localtime($Data{"Col001"});
$postedby = $Data{"Col003"};
$title = $Data{"Col002"};
$guts = $Data{"Col007"};
$link = $Data{"Col008"};
$linkname = $Data{"Col010"};
$newguts = "";
my $p = new HTML::TokeParser ($guts);
while ($_ = $p->get_token){ $newguts .= @$_[1] if @$_[0] eq 'T'; }
$line = qq~<spush><Font:Univers Condensed:22><color:00AAFF>$title<spop>\n~;
$line .= qq~<spush><color:ffffff><font:impact:18>$date<spop>\t~;
$line .= qq~<spush><color:aaffff><font:impact:18> Post By : $postedby<spop>\n~;
if ($link gt "")
{
$line .= qq~LINK: [$link] \n~;
}
$line .= qq~$newguts\n\n~;
print "$line";
$art++;
}This reads my news from inside Tribes2
function GetShifterNews()
{
$ShifterNewsLine = 0;
ShifterNewsText.setText ("");
%server = "www.webserver.com:80";
%serverpath = "/";
%requeststring = "/cgi-bin/cgi.pl?getshifternews";
%upd = new SecureHTTPObject(ShifterNews){};
%upd.post(%server, %serverpath @ %requeststring, "", %upd);
}
function ShifterNews::onLine( %this, %line )
{
ShifterNewsText.setText (ShifterNewsText.getValue() @ "\n" @ %line);
}About the author

Torque Owner Tim Gift