brianbot (brianbot) wrote in lj2600,
brianbot
brianbot
lj2600

Curl send sprint text

I spent awhile trying to figure out how to send a text message from terminal using:

http://messaging.sprintpcs.com/textmessaging/compose

I came up with:

curl -d "phoneNumber=6122223345&message=TheMessage&callBackNumber=6125551234" http://messaging.sprintpcs.com/textmessaging/composeconfirm

When I did that, the response said:

Cookies Are Not Enabled
You cannot compose a message because cookies are not enabled in your web browser.
Please enable the use of cookies and then try again.

So, I tried playing with -c (cookie jar) and some other stuff. One time, I accidentally copy and pasted the line twice into the terminal (as well as mispelled confirm), so it looked like this:

curl --cookie-jar -c cookiez.tmp -d "phoneNumber=6122223345&message=TheMessage&callBackNumber=6125551234" http://messaging.sprintpcs.com/textmessaging/compirmcurl -c cookiez.tmp -d "phoneNumber=6122223345&message=TheMessage&callBackNumber=6125551234" http://messaging.sprintpcs.com/textmessaging/composeconfirm

This did weird stuff.  It downloaded the page twice.  First, I got:

curl: (6) Couldn't resolve host 'cookiez.tmp'
<html><head><title>302 Moved Temporarily</title></head>
<body bgcolor="#FFFFFF">
<p>This document you requested has moved temporarily.</p>
<p>It's now at <a href="/textmessaging/compose;JSESSIONID_JFS=G3RoKOOWKboKSMIIs2276fLRLSo4E2MCEa9JjB3xfJvKv2mIoNBP!-1839651730!182801594!7060!7002">/textmessaging/compose;JSESSIONID_JFS=G3RoKOOWKboKSMIIs2276fLRLSo4E2MCEa9JjB3xfJvKv2mIoNBP!-1839651730!182801594!7060!7002</a>.</p>
</body></html>

Saying the page is in a different spot.  Second, it downloaded the compose page, with the notice that the text message is in fact being sent!  The 2nd set of arguments is irrelevant and discarded, so the phone number must be set in the first set of arguments.

My question is, 1. Why does this work - I'd imagine the first page sets a cookie that is passed to the second page.  2. What could I have done to do this right the first time.

Phone numbers have been changed from their original values.
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 6 comments