HTTP coding


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HTTP coding
# 1  
Old 06-24-2015
HTTP coding

My company has an in house instant messaging system (like WhatsApp) where users can communicate with each other. I currently have code to email me certain items from my Sparc machine running SunOS 5.10. I want what I am emailing myself to now instant message me. The team that created the messenger has provided a blanket code to get this working. I know shell but not much as far as http stuff is concerned. The code they provided has a "curl" command in it. Apparently my OS doesn't support "curl". Can anybody provide an "curl" equivalent for my OS? Here is the code and notes that the messenger creators sent:

Code:
FROM_USERID=$1
FROM_PASSWORD=$2
TO=$3
MSG=$4
BOT_SERVICE="http://bots.q.mycompany.com:8011/QBotService/BotTalk"

MESSAGE="xmlMessage=<message \
type=\"contact.send.message\" \
id=\"$FROM_USERID\" \
password=\"$FROM_PASSWORD\" \
contactId=\"$TO\"> \
<statement from=\"$FROM_USERID\" \
to=\"$TO\" \
text=\"$MSG\"/></message>"

## echo $MESSAGE - uncomment this if debugging, to see the string sent to the Bot Service

## (1) use this command to suppress display of the response
curl -s -d "${MESSAGE// /%20}" $BOT_SERVICE   > /dev/null   

## (2) use this command to display the response from the Bot Service - helpful for debugging
## curl -s -d "${MESSAGE// /%20}" $BOT_SERVICE


Here are the notes:

Just send this via HTTP or HTTPS to: http://bots.q.mycompany.com:8011/QBotService/BotTalk
It's best to use HTTPS and POST, but you can also send it via HTTP GET with ?xmlMessage=<xml here...>
# 2  
Old 06-24-2015
There's more than curlto POST messages, try lynx or - although not designed therefor - wget, if available on your system.
# 3  
Old 06-24-2015
So I swapped 'curl' with 'wget' and get the following error. Ironically I get the same error with the 'curl' version:

Code:
"${MESSAGE// /%20}": bad substitution

# 4  
Old 06-24-2015
That's a shell error msg, not curl nor wget. What shell are you using?

And, wget does have other options that curl has. Read man wget on how to POST messages.
# 5  
Old 06-24-2015
Quote:
Originally Posted by shorty
Apparently my OS doesn't support "curl".
Apparently there is: cURL - Download

also see https://www.opencsw.org/package/curl/

I hope this helps.

bakunin
# 6  
Old 06-24-2015
Quote:
Originally Posted by RudiC
That's a shell error msg, not curl nor wget. What shell are you using?

And, wget does have other options that curl has. Read man wget on how to POST messages.
I'm using KornShell.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log

Hi, I'm trying to write a script to determine the time gap between HTTP PUT and HTTP DELETE requests in the HTTP Servers access log. Normally client will do HTTP PUT to push content e.g. file_1.txt and 21 seconds later it will do HTTP DELETE, but sometimes the time varies causing some issues... (3 Replies)
Discussion started by: Juha
3 Replies

2. Web Development

HTTP Headers Reference: HTTP Status-Codes

Hypertext Transfer Protocol -- HTTP/1.1 for Reference - HTTP Headers 10 Status Code Definitions Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response. (1 Reply)
Discussion started by: Neo
1 Replies

3. Windows & DOS: Issues & Discussions

Need help with coding

HI, Can some one guide me how to make changes to the script below so that it can load the history of a program to IT server ? Format of data: YYYYMMDD065959.dsk.log YYYYMMDD235959.dsk.log currently both are loaded together. Need to separate them as above format. Thanks in advance. ... (2 Replies)
Discussion started by: crazydude80
2 Replies

4. Shell Programming and Scripting

Need help with coding

HI, Can some one guide me how to make changes to the script below so that it can load the history of a program to IT server ? Format of data: YYYYMMDD065959.dsk.log YYYYMMDD235959.dsk.log currently both are loaded together. Need to separate them as above format. Thanks in advance. ... (1 Reply)
Discussion started by: crazydude80
1 Replies

5. Shell Programming and Scripting

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (4 Replies)
Discussion started by: senkerth
4 Replies

6. Programming

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (0 Replies)
Discussion started by: senkerth
0 Replies

7. UNIX for Advanced & Expert Users

can I use this coding

I apologise because I had pasted this question in the newbies forum first (because i am a bit of a newbie) but thought it might be better suited in here if i have to sepearate parameters can I use this syntax especially the or part (||) and is this correct if (6 Replies)
Discussion started by: w33man
6 Replies
Login or Register to Ask a Question