This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MrSherenai's profile picture

Some questions on HTTP API

Started by MrSherenai, 01 March 2012 - 10:35 PM
MrSherenai #1
Posted 01 March 2012 - 11:35 PM
Hey,

im messing around with the http api and wondering what http.get() delivers. Meaning the type, and how i can access it.

I tested it with this code i found.
url = "http://www.myside.de/myscript.php"
file = http.get( url )
a = file:readLine()
file:close()

[left]
When i print a it returns the echo of my script and a 1 in the next line. My question is what type of data http.get() returns and how i can access it? I need just the echo of my script to be saved, not this 1.[/left]
Advert #2
Posted 02 March 2012 - 12:15 AM
Here's a working example script: http://www.computercraft.info/forums2/index.php?/topic/82-13-httptest/
Casper7526 #3
Posted 02 March 2012 - 12:25 AM
if your using the lua interp inside of CC ("typing lua") and running your commands there.

The 1 you see is the amount of lines that a print statement takes up on the screen.

If you typed that code into a program and did print(a) inside the program you shouldn't see the 1 :unsure:/>/>