make).
make install to install WebScript to /usr/local/bin.AddType application/x-httpd-cgi .scrThis example httpd.conf configuration block specifies that the directory containing the .scr files is a CGI directory, and that access to that directory is restricted to computers at your institution. For the example, we have used my-webscripts-dir as the location of the .scr files and OCLC's IP range; these values should be replaced with the appropriate values for your institution:
<Directory /my-webscripts-dir> Options ExecCGI <Limit GET> order deny,allow deny from all allow from 132.174. </Limit> </Directory>
HOST "host:port"WAIT "n"SET "var=string"DISPLAY "string"SEND "string"
Note: If the string is being sent to an HTTP server, that
server will perform an HTTP decoding
on the string it receives. For this reason, it is
necessary to escape some characters with their percent
encoding.
For example, if your password has a % sign
in it you will need to replace it with %25.
RECEIVE "n", "start"SCAN "n", "start", "end", varABSOLUTE "string"BASE "string"ENCODE "string", varONERROR "string"ONERROR SWITCH
CASE "number: string"
CASE "number: string"...
DEFAULT: "string"EXIT
#!/usr/local/bin/webscript
DISPLAY "Content-type: text/html\n\n" DISPLAY "<HTML> <HEAD>" DISPLAY "<TITLE> Search Results</TITLE>" DISPLAY "</HEAD>" DISPLAY "<BODY>" SET "string1=This is a test\r\n\r\n" DISPLAY "String1 = $string1$" SET "string2=$string1$" DISPLAY "String2 = $string2$" DISPLAY "\r\n"
DISPLAY "</BODY>" DISPLAY "</HTML>"
#!/usr/local/bin/webscript
# Open a socket to host
HOST "www.ncsa.uiuc.edu:80"
# Send a GET command
SEND "GET / HTTP/1.0\r\n\r\n"
# Read response (even though we don't want to scan for anything
SCAN 5, "", "", null
# Display response to user
DISPLAY ""
#!/usr/local/bin/webscript
#
# Real Example
#
# The server at www.ref.oclc.org:2000 is a state-full server that constructs
# the response URL with embedded session information. We are going to capture that
# session information and use it to take the user directly to the query screen for
# a specific database.
#
# Define some variables to use later.
SET "host=www.ref.oclc.org:2000"
SET "user=Vince"
SET "password=Smile"
SET "journal=APLO"
#
# Define who we are going to communicate with and open a socket to them
# for future writes (remember that httpd closes the socket after serving
# a request).
HOST "$host$"
#
# Send a string to the host
SEND "GET /html/ejo_pswd.htm HTTP/1.0\r\n\r\n"
SCAN 60, "<FORM METHOD=POST ACTION=\"", "\">", string
#DISPLAY "$string$\n"
#
HOST "$host$"
SEND "POST $string$ HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: 100\r\n\r\nautho=$user$&password=$password$\r\n"
ONERROR "Location: http://$host$/html/ejo_pswd.htm\r\n\r\n"
SCAN 60, "<FORM method=POST ACTION=\"", "\">", string2
ONERROR ""
#DISPLAY "$string2$\n"
#
HOST "$host$"
SEND "POST $string2$ HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: 100\r\n\r\ndbname=$journal$\r\n"
SCAN 60, "", "", string3
#DISPLAY "$string3$\n"
BASE "http://$host$/"
#DISPLAY "$string3$\n\n"
#
# Display the buffer to the user
DISPLAY ""
#!/usr/local/bin/webscript
#
# Real Example
#
# The server at www.ref.oclc.org:2000 is a state-full server that constructs
# the response URL with embedded session information. We are going to capture that
# session information and use it to take the user directly to the query screen for
# a specific database.
#
# Define some variables to use later.
SET "host=www.ref.oclc.org:2000"
SET "user=Vince"
SET "password=Smile"
SET "journal=APLO"
#
# Define who we are going to communicate with and open a socket to them
# for future writes (remember that httpd closes the socket after serving
# a request).
HOST "$host$"
#
# Send a string to the host
SEND "GET /html/ejo_pswd.htm HTTP/1.0\r\n\r\n"
SCAN 60, "<FORM METHOD=POST ACTION=\"", "\">", string
#DISPLAY "$string$\n"
#
HOST "$host$"
SEND "POST $string$ HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: 100\r\n\r\nautho=$user$&password=$password$\r\n"
ONERROR "Location: http://$host$/html/ejo_pswd.htm\r\n\r\n"
SCAN 60, "<FORM method=POST ACTION=\"", "\">", string2
ONERROR ""
#DISPLAY "$string2$\n"
#
# Return a redirect to the browser and let it submit the request to the
# the server. This is useful for browsers that don't support the BASE
# tag.
DISPLAY "Location: http://$host$$string2$:dbname=$journal$\r\n\r\n"
#!/usr/local/bin/webscript
#
# Define some variables to use later.
SET "host=www.oclc.org"
SET "user=vince"
SET "password=smile"
#
HOST "$host$"
#
# UUEncode the password string
ENCODE "$user$:$password$", enc_pwd
#
# Send the get (including authorization)
SEND "GET /~tkac/secure/ HTTP/1.0\r\nAuthorization: Basic $enc_pwd$\r\n\r\n"
SCAN 60, "", "", string
BASE "http://$host$/~tkac/secure/"
#
# Send the contents of the received buffer to stdout
DISPLAY ""
#!/usr/local/bin/webscript
#
# Define some variables to use later.
SET "host=www.oclc.org"
SET "user=vince"
SET "password=smile"
#
HOST "$host$"
#
# UUEncode the password string
ENCODE "$user$:$password$", enc_pwd
#
# Send the get (including authorization)
SEND "GET /~tkac/secure/ HTTP/1.0\r\nAuthorization: Basic $enc_pwd$\r\n\r\n"
SCAN 60, "", "", string
ABSOLUTE "http://$host$/~tkac/secure/"
#
# Send the contents of the received buffer to stdout
DISPLAY ""