LinuxQuestions.org
Help answer threads with 0 replies.
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 2771 Comments 0
« Prev     Main     Next »

  



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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration