http post with data from variable?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting http post with data from variable?
# 1  
Old 12-05-2010
http post with data from variable?

Hi
am using a variable in my http post message which is getting data from the select query as follows. if i use some values assigned to that variable , http post works fine but if i use the data of select query its not working...what could be issue?

Code:
#!/bin/bash
export ORACLE_HOME=/oracle/product/9.2.0
export PATH=$PATH:$ORACLE_HOME/bin
smstext=$(sqlplus -s asdf/wert@db  <<END
set feedback off;
set heading off;
select 7 from dual;
exit;
END)
echo $smstext
(sleep 4; echo "GET  /cgi-bin/sendsms?username=zxc&password=qwe&to=123456789&text=$smstext HTTP/1.1"; echo
""; sleep 5) | telnet 10.10.10.10 9000
smstext=ownvalue
(sleep 4; echo "GET  /cgi-bin/sendsms?username=zxc&password=qwe&to=123456789&text=$smstext HTTP/1.1"; echo
""; sleep 5) | telnet 10.10.10.10 9000

The second one is working i.e smstext with assigned value "ownvalue".
but not the first one....echo $smstext responding correctly...

pls help me....
# 2  
Old 12-05-2010
$smstext probably needs to be in quotes.
# 3  
Old 12-06-2010
that i tried....its not ok.
# 4  
Old 12-16-2010
Hi,

I found out the problem,

Its the blank line which creates problem in the data assigned from sql query. after removing it became ok....

Code:
smstext1=`echo $smstext | sed -e 's/\n//'`

Login or Register to Ask a Question

Previous Thread | Next Thread

10 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. Shell Programming and Scripting

Parsing the http post request

Hi, I am trying to write a shell script to parse the post request data that it received to a xml file. Below is the post request data that script is receiving. -----------------------------7dd2339190c8e Content-Disposition: form-data; name="param1" 1... (2 Replies)
Discussion started by: jdp
2 Replies

3. Shell Programming and Scripting

Perl Http Post over SSL

Hello, I'm using a tunnel broker for tunneling IPv6 traffic, as my ISP does not support it natively. As of recent i switched from Hurricane Electrics tunnel broker to Sixxs. Whenever my IP address changes, i have to manually log in and change it. This is a bit cumbersome so i was thinking of... (0 Replies)
Discussion started by: regexp
0 Replies

4. Programming

Sending and Receiving data between Client, HTTP Proxy, and Remote Server

I am having problems receiving data from a remote server. It seems that I can send an HTTP request to any host such as http://www.google.com, but I can't get a reply. I'm sending the host a HTTP 1.0 request that is formatted as such: GET / HTTP/1.0 Host: http://www.google.com Connection:... (0 Replies)
Discussion started by: shubham92
0 Replies

5. Shell Programming and Scripting

Converting variable space width data into CSV data in bash

Hi All, I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for. My Input data in inputfile.txt 19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
Discussion started by: vharsha
4 Replies

6. UNIX for Advanced & Expert Users

Issue in Curl to send http POST request with attachment/multipart

Hi, I am using curl to hit a url using http in solaris 10 using commandline, I want to transfer an attachment(using multipart curl -F) also as a part of the request. If anyone has used kindly help me with the syntax. I am using below command: Code: /usr/local/bin/curl -v... (1 Reply)
Discussion started by: manishmaha
1 Replies

7. Shell Programming and Scripting

How to send XML data using HTTP Post Request

How to hit HTTP Post Request along with sending XML data to a Remote server through command line utility like wget (or anything else). (0 Replies)
Discussion started by: sandeep reddy
0 Replies

8. Programming

unable to get end of file while reading HTTP data from socket

I am trying to read HTTP data from a socket. However, for the final set of data being read using read(), read blocks and the control doesnt come back for further processing. I tried using select, but it didn't work... Any help would be greatly acknowledged.:) (2 Replies)
Discussion started by: Harish.joshi
2 Replies

9. UNIX for Advanced & Expert Users

how to read the data from an excel sheet and use those data as variable in the unix c

I have 3 columns in an excel sheet. c1 c2 c3 EIP_ACCOUNT SMALL_TS_01 select A.* from acc; All the above 3 col shoud be passed a variable in the unix code. 1.How to read an excel file 2.How to pass these data as variable to the unic script (1 Reply)
Discussion started by: Anne Grace
1 Replies

10. SCO

XML Import & HTTP Post

this may be very basic to some but all new to me I have an application running on SCO Unix server which issues an HTTP Post request to a server with the results being returned in I.E browser window in XML format I need to import these results into my customers application and dont know how to... (1 Reply)
Discussion started by: ccarcher
1 Replies
Login or Register to Ask a Question