I found out how to use Wifi to pass variables to .php scripts on the internet. You can just put them in the URL. Here are the programs I made.
dslua_php.lua:
require( "keyboard.inc.lua" )
SCREEN_TOP = 1
SCREEN_BOTTOM = 0
BGTopText = Screen.LoadTextBG()
Screen.Initialize( SCREEN_TOP, BGTopText )
BGTopText:PrintXY( 0, 0, "Connecting to WFC..." )
Wifi.ConnectWFC()
BGTopText:Clear()
function ReceiveMessage()
BGTopText:Clear()
receive_message = ""
Wifi.GetHTTP( "http://www.bio-gaming.com/dslua.php", receive_message )
BGTopText:PrintXY( 0, 0, receive_message )
end
function SendMessage( msg )
msg = string.gsub( msg, " ", "." )
unusedvariable = ""
Wifi.GetHTTP( "http://www.bio-gaming.com/dslua.php?msg=" .. msg, unusedvariable )
ReceiveMessage()
end
while Pads.Start() == false do
BGTopText:PrintXY( 0, 23, "A - Send B - Receive" )
if Pads.A() then
while Pads.A() do end
msg = keyboard()
SendMessage( msg )
end
if Pads.B() then
while Pads.B() do end
ReceiveMessage()
end
end
dslua.php :
<?php
if (isset($_GET['msg'])) {
$file = fopen("dslua.txt", "w");
fwrite($file, str_replace(".", " ", $_GET['msg']));
} else {
$file = fopen("dslua.txt", "r");
$message = fgets($file);
echo ($message);
}
?>
It stores the text in dslua.txt on my site. You can send and receive messages (each time overwriting dslua.txt) using the lua program, or using your web browser (type "bio-gaming.com/dslua.php" to see the current message or "bio-gaming.com/dslua.php?msg=insert.message.here" to send a message.)
BTW spaces don't seem to work yet so don't use them! Edit: Fixed the spaces!Oh and you'll need to download keyboard and put it in the same directory as the lua script for it to work:
http://www.bio-gaming.com/jeremy/dslua/index.php?act=keyboard