function SendScore(iScore , sUserName$) //Open an HTTP Connection con = CreateHTTPConnection() httpsOn = 0 //set whether you want to use SSL connection or not - we're not using one for this example. domain$ = "www.YourDomainName.com" directoryUserName$ = "myUserName" directoryPassword$ = "myPassword" secureDirectory = 1 directoryName$ = "myProtectedDirectory/" scriptName$ = "scores.php" //Set the host for the connection if secureDirectory = 1 SetHTTPHost(con , domain$ , httpsOn , directoryUserName$ , directoryUserPassword$) else SetHTTPHost(con , domain$ , httpsOn) endif //Create the post data that will be sent to the script. post$ = "name=" + sUserName$ + "&score=" + str(iScore) //Initiate the request - I prefer async so we can give the user a waiting screen while the connection is working. SendHTTPRequestASync(con , directoryName$ + scriptName$ , post$) time0 = GetMilliseconds() repeat timeNow = GetMilliseconds() timeElapsed = (timeNow - time0) Print("Time elapsed " + str(timeElapsed)) //Here we'd have an actual waiting animation or message. ready = GetHTTPResponseReady(con) if ready <> 0 or timeElapsed > 60000 //set a timeout limit done = 1 endif Sync() until done = 1 if ready = 1 // We got a response, let's see how to handle it. responseCode = val(GetHTTPResponse(con)) if responseCode = 1 //Tell the player that the score is a high score! elseif responseCode = -1 //Report that the score is not a high score. else //Report there was some sort of error. You may also want to try again at this point in case there was a temporary issue. endif elseif ready = -1 //Report there was a connection error - this could happen due to a lost internet connection or the server failed to respond. else //Report there was a timeout error. endif CloseHTTPConnection(con) DeleteHTTPConnection(con) endfunction