$! FETCH.C Usage Example $! Submitted by example form WASD_ROOT:[SRC.MISC]FETCH_EXAMPLE.HTML $! 01-OCT-2002 MGD reworked $! 14-APR-1999 MGD initial $! $! set verify $! show sym www_* $ set noon $ say = "write sys$output" $ fetch = "$cgi-bin:[000000]fetch" $! $ if f$type(WWW_FORM_HTTP_METHOD) .eqs. "" then WWW_FORM_HTTP_METHOD = "" $ if f$type(WWW_FORM_HTTP_VERSION) .eqs. "" then WWW_FORM_HTTP_VERSION = "" $ if f$type(WWW_FORM_URL) .eqs. "" then WWW_FORM_URL = "" $ if f$type(WWW_FORM_SUBMIT) .eqs. "" then WWW_FORM_SUBMIT = "" $! $ if f$locate("Responding",WWW_FORM_SUBMIT) .lt. f$length(WWW_FORM_SUBMIT) $ then $! $! ***** RESPONDING? BUTTON ***** $! $ say "Content-Type: text/plain" $ say "" $ fetch /url=*WWW_FORM_URL /check $ last$STATUS = $STATUS $ if last$STATUS $ then $ say "Server responded successfully!" $ else $ if f$type(fetch_status) .eqs. "" $ then $ say "Server did not respond ... ''f$message(last$STATUS)'" $ else $ say "Server responded with an error ... ''fetch_status'" $ endif $ endif $ exit $ endif $! $ if f$locate("Header",WWW_FORM_SUBMIT) .lt. f$length(WWW_FORM_SUBMIT) $ then $! $! ***** HEADER BUTTON ***** $! $ say "Content-Type: text/plain" $ say "" $ fetch /url=*WWW_FORM_URL - /header /nobody - /method=*WWW_FORM_HTTP_METHOD - /version=*WWW_FORM_HTTP_VERSION $ if .not. $STATUS $ then $ say "Script responded with an error ... ''fetch_response'" $ endif $ exit $ endif $! $ if f$locate("Body",WWW_FORM_SUBMIT) .lt. f$length(WWW_FORM_SUBMIT) $ then $! $! ***** BODY BUTTON ***** $! $ say "Content-Type: text/plain" $ say "" $ fetch /url=*WWW_FORM_URL - /body /noheader - /method=*WWW_FORM_HTTP_METHOD - /version=*WWW_FORM_HTTP_VERSION $ if .not. $STATUS $ then $ say "Script responded with an error ... ''fetch_response'" $ endif $ exit $ endif $! $ if f$locate("Both",WWW_FORM_SUBMIT) .lt. f$length(WWW_FORM_SUBMIT) $ then $! $! ***** BOTH BUTTON ***** $! $ say "Content-Type: text/plain" $ say "" $ fetch /url=*WWW_FORM_URL - /body /header - /method=*WWW_FORM_HTTP_METHOD - /version=*WWW_FORM_HTTP_VERSION $ if .not. $STATUS $ then $ say "Script responded with an error ... ''fetch_response'" $ endif $ exit $ endif $! $ if f$locate("Response",WWW_FORM_SUBMIT) .lt. f$length(WWW_FORM_SUBMIT) $ then $! $! ***** RESPONSE BUTTON ***** $! $ fetch /url=*WWW_FORM_URL - /method=*WWW_FORM_HTTP_METHOD - /version=*WWW_FORM_HTTP_VERSION $ if .not. $STATUS $ then $ say "Script responded with an error ... ''fetch_response'" $ endif $ exit $ endif $! $ if f$locate("Demonstrate",WWW_FORM_SUBMIT) .lt. f$length(WWW_FORM_SUBMIT) $ then $! $! ***** DEMONSTRATE BUTTON ***** $! $ url = "http://" + WWW_SERVER_NAME + ":" + WWW_SERVER_PORT +- "/wasd_root/src/misc/readme.html" $ say "Content-Type: text/html" $ say "" $ say "This is the WASD_ROOT:[SRC.MISC]README.HTML document via:" $ say "
  $ FETCH /URL=""''Url'"" /body /noheader
" $ say "
" $ say "" $ fetch /url=*Url /body /noheader $ say "
" $ say "

This is the WASD_ROOT:[SRC.MISC]README.HTML document via:" $ say "

  $ FETCH /URL=""''Url'"" /body /noheader /escape
" $ say "
" $ say "
"
$    fetch /url=*Url /body /noheader /escape
$    say "
" $ say "
" $ exit $ endif $! $ say "Content-Type: text/html" $ say "" $ say "Press one of the [action] buttons!"