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

Username:   Password: 
 RegisterRegister   
 ViewHTML Procedure
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ecliptical




PostPosted: Mon Dec 19, 2005 2:20 pm   Post subject: ViewHTML Procedure

Open's a Website and renders the HTML in a red-green combo to make a little easier to view.

I don't know that much about page redirects and such...so for some websites Turings Net. functions seem to go to the 302/301 redirect sites... I don't know how to work around this...

IF this could be corrected i guess we could see the start of some web based apps...perhaps...

code:
procedure ViewHTML (url : string)
    var netStream : int
    var net_line : string (1)
    netStream := Net.OpenURLConnection (url)
    if netStream <= 0 then
        put "Unable to connect to ", url, " on port 80"
        return
    end if
    var fileNo : int
    open : fileNo, "index.html", write
    loop
        exit when eof (netStream)
        get : netStream, net_line : 1
        var flag := false
        if net_line = "<" then
            color (red)
            put net_line ..
            write : fileNo, net_line
            flag := true
        elsif net_line = ">" then

            put net_line ..
            write : fileNo, net_line
            color (green)
            flag := false
        else
            put net_line ..
            write : fileNo, net_line
        end if
    end loop
    Net.CloseConnection (netStream)
    close : fileNo
end ViewHTML
put "hello"
ViewHTML ("www.digg.com")

Sponsor
Sponsor
Sponsor
sponsor
ecliptical




PostPosted: Mon Dec 19, 2005 2:23 pm   Post subject: (No subject)

Some sites that do seem to work correctly are.
www.yahoo.com
www.ninja.com

...
www.compsci.ca
unfortunately returns...
code:
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no_cache">
<title>Site Temporarily Unavailable</title>
</head>

<h1>Site Temporarily Unavailable</h1>

We apologize for the inconvenience. Please contact the webmaster/
tech support immediately to have them rectify this.<p>

<font size=2>error id: "bad_httpd_conf"</font>

</body>
</html>

Tony




PostPosted: Mon Dec 19, 2005 4:14 pm   Post subject: (No subject)

that page from compsci.ca is used to block off bots Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
ecliptical




PostPosted: Mon Dec 19, 2005 6:20 pm   Post subject: (No subject)

Thats good I guess =) I guess this could be used to make some sort of phisher/scanner. Anyway i figured out how to get past the redirection stuff so I'm going to mess around with a couple of apps and maybe a game as a proof of concept.


    Software Aunthentication/Registration/Activation:Program creates unique code which is checked against and online code.

    Online Walking Game: Walk around and new levels are downloaded as you reach them.


Thats pretty much it as I don't know yet how I can use turing to upload content to the web...any help?

I was thinking FTP perhaps because it does look like turing has the ports and such setup I'm just not sure how to program it.
Tony




PostPosted: Tue Dec 20, 2005 10:00 am   Post subject: (No subject)

ecliptical wrote:
Thats pretty much it as I don't know yet how I can use turing to upload content to the web...any help?

You could connect through a socket if you have an application server listening for a connection.

I think that a GET request to a PHP or Ruby script would be the easiest
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
MysticVegeta




PostPosted: Wed Dec 21, 2005 7:46 pm   Post subject: (No subject)

Tony wrote:
that page from compsci.ca is used to block off bots Wink


I am curious why would you hide the HTML?
Martin




PostPosted: Wed Dec 21, 2005 7:50 pm   Post subject: (No subject)

So they don't go through the entire site.

Almost 100,000 posts - At even 1kb per page, that's 100mb of bandwidth for just one bot.

100 bots, and we're out of bandwidth for the month.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: