FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Wed Jun 26, 2019 6:37 pm

All times are UTC




Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: http get troubles
PostPosted: Thu Jun 24, 2010 5:58 pm 
Offline

Joined: Tue Jun 08, 2010 6:10 pm
Posts: 2
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 ^_^


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited