Computer Science Canada

ViewHTML Procedure

Author:  ecliptical [ 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")


Author:  ecliptical [ Mon Dec 19, 2005 2:23 pm ]
Post 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>


Author:  Tony [ Mon Dec 19, 2005 4:14 pm ]
Post subject: 

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

Author:  ecliptical [ Mon Dec 19, 2005 6:20 pm ]
Post 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.

Author:  Tony [ Tue Dec 20, 2005 10:00 am ]
Post 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

Author:  MysticVegeta [ Wed Dec 21, 2005 7:46 pm ]
Post subject: 

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


I am curious why would you hide the HTML?

Author:  Martin [ Wed Dec 21, 2005 7:50 pm ]
Post 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.


: