xmlxmt.cgi 979 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#!/bin/sh

case "$REQUEST_METHOD" in 
    GET)
    if test -z "$QUERY_STRING" ; then
cat << EOF
Content-type: text/xml

<?xml version="1.0" ?>
<environment>
 <SERVER_NAME>$SERVER_NAME</SERVER_NAME>
 <SERVER_SOFTWARE>$SERVER_SOFTWARE</SERVER_SOFTWARE>
 <SERVER_PROTOCOL>$SERVER_PROTOCOL</SERVER_PROTOCOL>
 <SERVER_PORT>$SERVER_PORT</SERVER_PORT>
 <SERVER_SIGNATURE>$SERVER_SIGNATURE</SERVER_SIGNATURE>
 <REMOTE_ADDR>$REMOTE_ADDR</REMOTE_ADDR>
 <REMOTE_HOST>$REMOTE_HOST</REMOTE_HOST>
 <REMOTE_PORT>$REMOTE_PORT</REMOTE_PORT>
 <HTTP_USER_AGENT>$HTTP_USER_AGENT</HTTP_USER_AGENT>
 <HTTP_REFFERER>$HTTP_REFFERER</HTTP_REFFERER>
 <HTTP_REQUEST>$HTTP_REQUEST</HTTP_REQUEST>
 <DOCUMENT_ROOT>$DOCUMENT_ROOT</DOCUMENT_ROOT>
 <REQUEST_TIME>$REQUEST_TIME</REQUEST_TIME>
</environment>
EOF
    else
	   URL=`/usr/local/bin/unescape $QUERY_STRING`
      wget "$URL" -q -O /tmp/wget$$ >/tmp/wg
	   echo "Content-type: text/xml"
	   echo
	   cat /tmp/wget$$
	   rm  /tmp/wget$$
    fi
	;;
esac