anyone know how? Thanks if you can.
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
[Lua] [Error] Http Api
Started by justync7, 12 April 2012 - 01:12 AMPosted 12 April 2012 - 03:12 AM
So, I am trying to create a program that gets the http from http://www.tiny.cc/lolosver but i keep getting a "attempt to index ? (a nil value)"
anyone know how? Thanks if you can.
anyone know how? Thanks if you can.
Posted 12 April 2012 - 03:14 AM
Code? Hard to find whats wrong without it.
Read this… http://www.computercraft.info/forums2/index.php?/topic/475-get-help-faster-read-me/
Read this… http://www.computercraft.info/forums2/index.php?/topic/475-get-help-faster-read-me/
Posted 12 April 2012 - 08:35 AM
yeah we cant really help you if there is no code to look at (the only thing we can really do is tell u what the error means!?)
Posted 12 April 2012 - 12:11 PM
well what u can do is the following thing :P/>/>
the var ver shoud be all the webpage content :D/>/>
but i dont know if tiny.cc is the problem :)/>/>
local file = http.get("http://www.tiny.cc/lolosver")
local ver = file:readAll()
the var ver shoud be all the webpage content :D/>/>
but i dont know if tiny.cc is the problem :)/>/>
Posted 12 April 2012 - 12:50 PM
You probably don't have the http API on. go to .minecraftconfigmod_ComputerCraft.cfg, and change "enableAPI_http=0" to "enableAPI_http=1"
Posted 12 April 2012 - 11:22 PM
Http API Enabled And What I Wanted Was A Explanation Of How It Works. Like Kolpa Did.
EDIT: @Kolpa Using That Code And Adding Only print(ver) I still get test:1:Attempt to index ? (a nil value)
EDIT: @Kolpa Using That Code And Adding Only print(ver) I still get test:1:Attempt to index ? (a nil value)
Posted 13 April 2012 - 07:28 PM
well like i said try to not use the tiny.cc link use the real one so like this:
:P/>/>
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html:P/>/>
Posted 13 April 2012 - 09:35 PM
Or txt :D/>/>well like i said try to not use the tiny.cc link use the real one so like this:or rename it to .htmllocal file = http.get("http://dl.dropbox.com/u/50273341/version.http") local ver = file:readAll()
:P/>/>
Posted 13 April 2012 - 10:30 PM
well i dont now cuz its made for reading websites so i thought html woud be better :)/>/>Or txt :D/>/>well like i said try to not use the tiny.cc link use the real one so like this:or rename it to .htmllocal file = http.get("http://dl.dropbox.com/u/50273341/version.http") local ver = file:readAll()
:P/>/>
Posted 14 April 2012 - 09:22 AM
Well… I got it to read txts from my website and DCPU16 specifications from 0x10c. :)/>/>well i dont now cuz its made for reading websites so i thought html woud be better :)/>/>Or txt :D/>/>well like i said try to not use the tiny.cc link use the real one so like this:or rename it to .htmllocal file = http.get("http://dl.dropbox.com/u/50273341/version.http") local ver = file:readAll()
:P/>/>
Posted 14 April 2012 - 12:45 PM
Well… I got it to read txts from my website and DCPU16 specifications from 0x10c. :)/>/>well i dont now cuz its made for reading websites so i thought html woud be better :)/>/>Or txt :)/>/>well like i said try to not use the tiny.cc link use the real one so like this:or rename it to .htmllocal file = http.get("http://dl.dropbox.com/u/50273341/version.http") local ver = file:readAll()
:)/>/>
well then :)/>/>
btw woudnt use dropox for this cuz u cant change the file with the linkwell like i said try to not use the tiny.cc link use the real one so like this:or rename it to .htmllocal file = http.get("http://dl.dropbox.com/u/50273341/version.http") local ver = file:readAll()
:)/>/>
Posted 14 April 2012 - 12:50 PM
i can code u a php/mysql db ver tool and give u some webspace if u want :)/>/>
okay all set pm me and u get it :)/>/>
and yes it works :)/>/> tested
local file = http.get("http://mastersofarms.no-ip.org/ver.php")
local ver = file:readAll() print(ver)
gonna code a vb ver changer and pm it to u if interested :)/>/>okay all set pm me and u get it :)/>/>
and yes it works :)/>/> tested
Edited on 14 April 2012 - 11:45 AM