Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Website Testing App

edited October 2017 in Code Sharing Posts: 79

A simple tool to test websites and the like. It can also be used to get data from a server. IDK, could prevent someone from getting a virus or something.

function setup()
    parameter.text("Site", "http://")
    parameter.action("Test", testSite)
    parameter.action("Go", go)
    parameter.boolean("ReturnData", false)
    parameter.boolean("ReturnHeaders", false)
    parameter.action("Clear Output", output.clear)
    globeColor = color(0, 0, 255, 255)
    connecting = false
end

function draw()
    background(0, 0, 0, 255)
    pushMatrix()
    fontSize(500)
    fill(globeColor)
Tagged:

Comments

  • edited October 2017 Posts: 79
        text("O", WIDTH/2, HEIGHT/2+100)
        fontSize(92)
        fill(255, 255, 255, 255)
        text("Web Testing", WIDTH/2, 100)
        if (connecting) then
            text("...", 50, 50)
        end
        rotate(45)
        popMatrix()
    end
    
    function s(data, status, headers)
        print(Site .. ": Success! Status " .. status)
        if (ReturnData) then
            print("HTML: " .. data)
        end
        if (ReturnHeaders) then
            print("Headers:")
            for i,v in ipairs(headers) do
                print(i .. ": " .. v)
            end
        end
        globeColor = color(0, 255, 0, 255)
        connecting = false
    end
    
    function f(error)
        print("Error: " .. error)
        globeColor = color(255, 0, 0, 255)
        connecting = false
    end
    
    function testSite()
        connecting = true
        http.request(Site, s, f)
    end
    
    function go()
        openURL(Site, true)
    end
    

    Sorry, text got cut off.

  • em2em2
    Posts: 194

    You can fix your post by pressing on the gear icon in the top-right corner.

  • @em2 Yeah, I knew that, but for some reason, this forum doesn't like emojis, and posts that have emojis will get cut off at the emoji...

  • em2em2
    edited October 2017 Posts: 194

    Maybe that should be posted as a bug on the bug thread. It probably has something to do with the backend. "ᄒ" [U+FFBE] is the highest visible unicode char supported. U+10000 and beyond do not display and are treated as EOF. A few emoji are in that range, but most of the older ones should work fine.

Sign In or Register to comment.