Raw

Raw
//The intent of RAW is really so you can create web services. Another program (even another RB program) can access the server and get back a pure text answer. This could be readable text, XML, rows of comma separated values, or whatever.// - user:CarlGundel

Syntax: RAW expr$ //- Stop execution and return the contents of expr$ as the entire web page with a MIME type of text/plain//

This demo returns user IP as a string, like this IP program: code format="vbnet" raw UserAddress$ code

This demo returns the user's browser info as a string: code format="vbnet" raw UserInfo$ code

This example returns XML for a PAD file. It's a truncated version of a PAD file for demonstration purposes only. code format="vbnet" cr$ = chr$(13) + chr$(10) pad$ = " " pad$ = pad$ + cr$ + "- " pad$ = pad$ + cr$ + "- " pad$ = pad$ + cr$ + " Acme Enterprises " pad$ = pad$ + cr$ + "" pad$ = pad$ + cr$ + "- " pad$ = pad$ + cr$ + "Acme Application " pad$ = pad$ + cr$ + "" pad$ = pad$ + cr$ + " " raw pad$ code

This example displays the results obtained by retrieving the HTML from the runbasic site. code raw httpget$("http://www.runbasic.com/")

code Here is an example of very simple app that uses RAW and the URLKeys$ variable to create a web service that adds two numbers: code 'add two numbers 'form your URL like so - '  http://mydomain.com/seaside/go/runbasic?app=adder&firstNum=3&secondNum=4

'the answer is a number but with RAW you must use STR$ to 'provide the answer as a string raw str$(val(urlKeyNamed$("firstNum"))+val(urlKeyNamed$("secondNum")))

function urlKeyNamed$(keyName$) item$ = "placeholder" while item$ <> "" x = x + 1 item$ = word$(UrlKeys$, x, "&") match = word$(item$, 1, "=") = keyName$ if match then urlKeyNamed$ = word$(item$, 2, "=") item$ = "" end if   wend end function code