Difference between revisions of "Curl Interactive Client"

From Textserver wiki
Jump to: navigation, search
(Created page with "<syntaxhighlight lang="python" line="1" > </syntaxhighlight>")
 
 
Line 1: Line 1:
<syntaxhighlight lang="python" line="1" >
+
<syntaxhighlight lang="bash" line="1" >
 +
#! /bin/sh
 +
 
 +
########################################################################
 +
#
 +
#  Example client to submit an interactive request to TextServer
 +
# SERVICENAME service.
 +
#  Input may be a plain text or a text file.  No ZIP files.
 +
#  Output will be in the requested format (XML, json, conll)
 +
#
 +
########################################################################
 +
 
 +
# Get query parameters
 +
echo -n "Text to analyze: "
 +
read TEXT
 +
echo -n "Language: "
 +
read LANGUAGE
 +
echo -n "Output format (xml,json,conll,naf): "
 +
read OUT
 +
echo -n "TextServer username: "
 +
read USERNAME
 +
echo -n "TextServer password: "
 +
read PWD
 +
 
 +
# URL for the requested service
 +
SERVICE="SERVICENAME";
 +
URL="http://frodo.lsi.upc.edu:8080/TextWS/textservlet/ws/processQuery/"$SERVICE;
 +
 
 +
# send request to server
 +
curl -X POST  \
 +
    --form "username=$USERNAME"  \
 +
    --form "password=$PWD"  \
 +
    --form "language=$LANGUAGE" \
 +
    --form "text_input=$TEXT" \
 +
    --form "output=$OUT" \
 +
    --form "interactive=1" \
 +
      $URL
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 13:03, 20 January 2016

 1 #! /bin/sh 
 2 
 3 ########################################################################
 4 #
 5 #  Example client to submit an interactive request to TextServer 
 6 # SERVICENAME service. 
 7 #  Input may be a plain text or a text file.  No ZIP files.
 8 #  Output will be in the requested format (XML, json, conll)
 9 #
10 ########################################################################
11 
12 # Get query parameters
13 echo -n "Text to analyze: "
14 read TEXT
15 echo -n "Language: "
16 read LANGUAGE
17 echo -n "Output format (xml,json,conll,naf): "
18 read OUT
19 echo -n "TextServer username: "
20 read USERNAME
21 echo -n "TextServer password: "
22 read PWD
23 
24 # URL for the requested service
25 SERVICE="SERVICENAME";
26 URL="http://frodo.lsi.upc.edu:8080/TextWS/textservlet/ws/processQuery/"$SERVICE;
27 
28 # send request to server
29 curl -X POST  \
30      --form "username=$USERNAME"  \
31      --form "password=$PWD"  \
32      --form "language=$LANGUAGE" \
33      --form "text_input=$TEXT" \
34      --form "output=$OUT" \
35      --form "interactive=1" \
36       $URL