Posted 31 October 2012 - 07:54 PM
Quite simply, i want my script to take what is on a pastebin page, and save it as a variable. I haven't found any way of doing it yet, although i am sure it is staring me in the face.
local response = http.get(
"http://pastebin.com/raw.php?i="..textutils.urlEncode( sCode ) -- to get the code
)
if response then
print( "Success." )
local sResponse = response.readAll()
response.close()
local file = fs.open( sPath, "w" )
file.write( sResponse )
file.close()
print( "Downloaded as "..sFile )
else
print( "Failed." ) -- This means the url does not exist.
end
ah, thanks, i was missing off the whole url encoding bit, derp.
erm, yeah, totaly new to the HTML api, i haven't needed it until a relatively exciting new project has needed it.