Curl Interactive Client
From Textserver wiki
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