FBA The Creator
http://www.fbacreator.com/fbaforum/

http get troubles
http://www.fbacreator.com/fbaforum/viewtopic.php?f=5&t=240
Page 1 of 1

Author:  SoUrcerer [ Thu Jun 24, 2010 5:58 pm ]
Post subject:  http get troubles

I tried to do something with sockets in FBA, and successfully had access to my email via pop3 and smtp.
Now I try to get some plain text using sockets and HTTP.

Code:
local zx=10
local sock=socket.tcp()
local finalStr = "Establishing connection.."

-- connect to a webserver
sock:settimeout(25)
sock:connect("www.helvi.su", 80)
sock:send("GET /tiny/result HTTP/1.0\r\n")
sock:send("Host: helvi.su\r\n\r\n")


function onmainloop()
       print(10,zx, finalStr,255,0,0)
       data,err = sock:receive()
       if data ~= nil then
                        finalStr=data
                        zx=zx+10                   
               end
   
end

function onstylusdown(x,y)
        quit()
end

function onquit()
        sock:close()
end


My code (you see, it's based on example 21) gives to me only headers of page:

Code:
Establishing connection..
HTTP/1.1 200 OK
Date: Thu, 24 Jun 2010 17:46:30 GMT
Server: Apache/2.2.14 (Unix)
Last-Modified: Thu, 24 Jun 2010 17:41:18 GMT
ETag: "845e6176-d-489ca296fb07b"
Accept-Ranges: bytes
Content-Length: 13
Connection: close
Content-Type: text/plain


But when I use telnet:

Code:
>>GET /tiny/result HTTP/1.0
>>Host: helvi.su
>>
<<HTTP/1.1 200 OK
<<Date: Thu, 24 Jun 2010 17:46:30 GMT
<<Server: Apache/2.2.14 (Unix)
<<Last-Modified: Thu, 24 Jun 2010 17:41:18 GMT
<<ETag: "845e6176-d-489ca296fb07b"
<<Accept-Ranges: bytes
<<Content-Length: 13
<<Connection: close
<<Content-Type: text/plain
<<
<<file created.


"file created" - it's content of file http://helvi.su/tiny/result

What's wrong? :(
Help me please ^_^

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/