Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Internet
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheFerret




PostPosted: Fri Jul 16, 2004 8:30 pm   Post subject: Internet

Would it be possible to have Turing read a webpage and store certain things into an array... (read from a list)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jul 16, 2004 9:03 pm   Post subject: (No subject)

yes, using Net. module... but it will crash when you try to read a string exceeding 255 characters in size (and those appear more often then you think... especially on large sites)

i'm not sure if you can read per character... somebody would have to look into that
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
the_short1




PostPosted: Tue Jul 20, 2004 11:46 am   Post subject: (No subject)

code:

var netStream : int
var line : string
netStream := Net.OpenURLConnection ("http://www.geocities.com/the_short22/index.html")
% change the addy all u want... but make SHURE it ends in .html or .php or w/e cuz turing will crash..
% just get the full addy..   
loop
        get : netStream, line
        put line
        exit when eof (netStream)
    end loop
Net.CloseConnection (netStream)


try that out!

just make shure u use a full addy... if u dont include the extension turing with CRASH!

... and u can go ....

if line = "<body>" then

... to search for lines...

ENJOY!
the_short1




PostPosted: Tue Jul 20, 2004 12:14 pm   Post subject: (No subject)

o.. let me guess.... instead of having to include the data file with the program.. include it on the net... that way it cant be modified... (lets say a highscore list) and it would be updated all the time.... OMG... i think i just got a REALLY good IDEA!!!!


for games with highscores... list the highscores as a webpage (not working webpage... just a .txt file renamed to .html... . so u can add highscores in whenever and it would update on the spot.. wihtout having to recompile ur program!.... also that way u cant cheat .. (by modifying the highscore file...)



ok... heres ur array deal... i made a webpage with just words...


code:

var netStream, linecount : int
linecount := 0
var line : string
var list : array 1 .. 2000 of string
netStream := Net.OpenURLConnection ("http://www.members.shaw.ca/rfolz/list.html")
loop
    get : netStream, line
    put line
    if line not= "<br>" and line not= "<html>" then    % to seperate lines u need <br> tags
        linecount += 1
        list (linecount) := line
    end if
    exit when eof (netStream)
end loop
Net.CloseConnection (netStream)
put "This Is All The Info From That Webpage!"
for a : 1 .. linecount
    put list (a)
end for


but it seems not to work properly for my list.html page... but is fine for other pages... dunno... maybe u need to acually have it proper html and just exclude and tags form it... i dont know..

but it works for other pages just fine..
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: