Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

HTTP response status

 [1/2] from: tmoeller:fastmail:fm at: 7-Oct-2010 17:03


Hi all, in my app i make an http request like "read/custom url [ GET ]". How do i access the response codes to react on them?? I see them when tracenet is on, but was not able to find anywhere to use it. Docs weren't as helpful as i hoped. Any suggestions?? Cheers Thorsten -- http://www.fastmail.fm - One of many happy users: http://www.fastmail.fm/docs/quotes.html

 [2/2] from: hallvard:ystad:babelserver at: 8-Oct-2010 0:12


Here's something I used once. Don't know where I got it from, it might very well be this list. Works with R2, not tested otherwise: insert-this: {GET / HTTP/1.0 Host: www.rebol.com connection: close user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) } port: open/lines [ scheme: 'tcp host: "www.rebol.com" port-id: 80 ] insert port insert-this header: make block! 100 while [ reply: first port not empty? reply ] [ parse reply [ [copy name [thru #":"] (name: load name) | copy name [to end] (append header reduce [name ""])] [copy value to newline | copy value to end] (if value [append header reduce [name value]]) ] ] either [ not empty? content: first port ] [content: copy port] [print "EMPTY!"] close port probe header ;print reduce [content] halt Dixit Thorsten Moeller (17:03 07.10.2010):