Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.tcp.httpGetStatusCode
on httpGetStatusCode (httpResult) {
<<Changes
<<8/6/08; 8:31:29 AM by DW
<<Return the status code of the HTTP request, something like 200, 301, 404, etc.
return (string.nthField (httpResult, ' ', 2))}
<<bundle //test code
<<dialog.alert (httpGetStatusCode (tcp.httpClient ("HEAD", "scripting.com"))) //200
<<dialog.alert (httpGetStatusCode (tcp.httpClient (server:"scripting.com", path:"hitler"))) //404
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.