8 posts
Location
U.S.A.
Posted 08 October 2016 - 01:45 AM
I have a basic website hosted on the internet that just displays the time.
http://javascriptclock.neocities.org/ In case you wanted to look. When I get the html code using httptest, (
http://www.computerc...1-httptest-v14/) it doesn't show the time that would be updated. Instead, It just shows the
<span id="clock">&nbsp;</span>
that is in the original code. I know the basics of http, but is there a way to read the time from the website?
350 posts
Posted 08 October 2016 - 02:45 AM
No, the HTTP API only gets the webpage, and doesn't parse any of it. You will need to use a website that hosts the time as text, rather than a script that runs in a browser.
This might be closer to your needs.
7083 posts
Location
Tasmania (AU)
Posted 08 October 2016 - 02:51 AM
Not from the page you've set up, no. The http API gets you whatever code the web server would pass to a web browser - in this case, that's a bunch of Javascript that your browser would use to show you the time. The time itself is not provided by the web server, instead the browser is expected to figure it out for itself, and if ComputerCraft could do that then you wouldn't be using the http API for this in the first place. ;)/>/>
Most often this sort of thing is done using a php server, which executes the code before passing it to the requesting system - meaning it can actually return a document which includes the time.
Edit: Ninja'd.
Edited on 08 October 2016 - 12:52 AM
8 posts
Location
U.S.A.
Posted 08 October 2016 - 02:54 AM
Okay, thanks for your responses. The link that 3d6 provided was exactly what I needed.