How can I read text from the internet?

Answered How can I read text from the internet?

  • Monday, June 18, 2012 10:37 PM
     
     

    Allow me to explain. I want to make a program for a project that does the following:

    The user is given the options "Hamburger" and "Sandwich" as buttons on the screen. The user clicks on the option he wants, and then another user receives the message "Table 2 wants a _________(hamburger or sandwich)".

    After some thinking, I thought this would be the easiest way to do it: Creating "two-sided" program composed of two exe's. The first one creates a text file with the information given by the user, and the second one displays the content of that text file. To do this, program #1 creates a text file that says "The customer wants a X" (X being the choice of the user).  This text is then submitted to the internet, and a second program simply downloads this text and prints it on the screen.

    I know how this could be done if the text file is saved on the hard drive, but then the program loses it's purpose, which is to order food remotely. Is there a way to upload and read text to and from the internet using Small Basic?




    • Edited by norik434 Monday, June 18, 2012 10:38 PM
    • Edited by norik434 Monday, June 18, 2012 10:39 PM
    • Edited by norik434 Monday, June 18, 2012 10:39 PM Grammar
    •  

All Replies

  • Tuesday, June 19, 2012 12:07 AM
     
     

    Hey norik434,

    You can use Network.DownloadFile(url) to download files from the internet, I think the problem you will have is to upload them as SmallBasic standard can only write to your HDD I believe.

    Maybe if your programs (both clients) used a pc as the server for the text files and read/write to the one main computer? They might be able to write to local networks not sure though haven't tried.

  • Tuesday, June 19, 2012 2:13 AM
     
     Answered Has Code

    I was curious about this as well, for a head to head game. I was able to get it to work through a shared local network drive with two computers. Just sent a line of text from one pc and read it on another pc. Nothing useful yet!

    I'm setting up to try FTPing to a web server but I can't even get inernet explorer to work on my new host. Not giving up yet! The thought is to put the ftp address into the path of small basic code but now I'm thinking small basic isn't going to handle the ftp protocol. We'll see.

    I have it reading a file from the web here, but I can't get the upload working via ftp. If your user's input was on a web server you could do it.


    'File Handling -- Read file from the web
    url = "http://krueg.com/sb/ftp/filenumber1.txt"
    TextWindow.Show()
    TextWindow.WriteLine("Here is the text that was saved -- ")
    a = Network.DownloadFile(url)
    b = File.ReadContents(a)
    TextWindow.WriteLine(b)
    TextWindow.WriteLine("")
    TextWindow.WriteLine("Press a key")
    i = TextWindow.Read()

  • Tuesday, June 19, 2012 8:37 AM
     
     Answered
    I believe Data Extensions has some extra network functionality, that is of course if you want to use extensions.