Posted 15 November 2013 - 12:02 AM
So… after about an hour of testing, I absolutely could not get this to work. I am trying to make a GitHub importing program, and it always returns an empty string. Could someone help me?
1. Yes, this is code from the Pastebin program. Like I said, I was experimenting.
2. I have tried this using Pastebin. It works perfectly.
3. That URL is valid. Try it yourself.
4. Pastebin code: STna0YV9
It always does this:
- Waits around a second, which seems like the program's actually receiving data.
- Prints out this message.
local function get(paste)
local response = http.get(
"http://raw.github.com/DiabolusNeil/testingRepo/master/"..textutils.urlEncode(paste)
)
if response then
print("Success")
local sResponse = response.readAll()
response.close()
return sResponse
else
print("Failed")
response.close()
end
end
local res = get("prog")
if res then
wFile = fs.open("testing","w")
wFile.write(res)
print(res)
wFile.close()
print("Downloaded 'prog'")
else
print("Error")
end
1. Yes, this is code from the Pastebin program. Like I said, I was experimenting.
2. I have tried this using Pastebin. It works perfectly.
3. That URL is valid. Try it yourself.
4. Pastebin code: STna0YV9
It always does this:
- Waits around a second, which seems like the program's actually receiving data.
- Prints out this message.
Edited on 14 November 2013 - 11:11 PM