LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > Marcelo_Vergara
User Name
Password

Notices

Rate this Entry

HTo - HTTP POST with BASH

Posted 08-01-2008 at 01:22 PM by Marcelo_Vergara

#!/bin/bash

if [ -z $1 ] || [ -z "$2" ]; then
echo "Uso: $0 phone \"string\""
exit 1
fi

TEL=$1
MSG=$2

HOST="172.26.1.75"
URL="/pluggingForward/sendMessage.jsp"
PORT="80"

PROF="hehehehehe"
PWD="hahahaha"
ANUM="927"

TAM=`echo "<REQUEST PROF=\"war_sms_mt\">
<PWD>hahahaha</PWD>
<APP_TAG></APP_TAG>
<ANUM>927</ANUM>
<BNUM>$TEL</BNUM>
<PLOAD>
<SMS>$MSG</SMS>
</PLOAD>
</REQUEST>" | wc -c`

echo "POST $URL HTTP/1.1
Host: $HOST
Content-Length: $TAM
Content-Type: text/wml

<REQUEST PROF=\"war_sms_mt\">
<PWD>hahahaha</PWD>
<APP_TAG></APP_TAG>
<ANUM>927</ANUM>
<BNUM>$TEL</BNUM>
<PLOAD>
<SMS>$MSG</SMS>
</PLOAD>
</REQUEST>" | /usr/bin/nc -w 10 $HOST $PORT >> /dev/null

if [ $? -eq "0" ]; then
exit 0
else
exit 1
fi
Posted in Uncategorized
Views 2644 Comments 0
« Prev     Main     Next »

  



All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration