These are the PHP functions I use to send Text Notifications through messagings.sprintpcs.com from a PHP script.
function http($host, $write)
{
$response = '';
$fp = fsockopen($host, 80);
if ($fp)
{
fwrite($fp, $write);
while (! feof($fp))
{
$response .= fgets($fp, 1024);
}
fclose($fp);
}
return($response);
}
function http_post($host, $page, $post)
{
$write = "POST $page HTTP/1.1\r\n" .
"User-Agent: unknown\r\n" .
"Connection: Close\r\n" .
"Host: $host\r\n" .
"Content-Length: " . strlen($post) . "\r\n" .
"Content-Type: application/x-www-form-urlencoded\r\n" .
"Cookie: \$Version=\"1\"; JSESSIONID=\"none\"\r\n" .
"\r\n" .
$post . "\r\n\r\n";
return(http($host, $write));
}
function sendnote($to, $message = '.', $from = '')
{
GLOBAL $track;
$host = 'messagings.sprintpcs.com';
$page = '/textmessaging/composeconfirm';
$post = "phoneNumber=".$to."&message=" . urlencode($message) .
"&callBackNumber=".$from;
$response = http_post($host, $page, $post);
ereg("\?trackNumber=([0-9A-Z]+)", $response, $regs);
$track = $regs[1];
if (stristr($response, "Message sent")) return 0;
if (stristr($response, "not subscribe")) return 2;
if (stristr($response, "Error")) return 3;
return 4;
}
// Example
$result_code = sendnote("8005551111", "Hi there!", "8005552222");
Note that the tracking number ends up in a global variable called $track.
HKVKitihTzQk
car insurance rates 600573 auto insurance 9810 business insurance quotes 1926 health insurance florida 078
NqYljRGupanKhfUdp
louisiana homeowners insurance jxfy car insurance %-DD insurance auto 9840
imavJQUfXMEKsgrPhI
buy check e tramadol 63285 buy cialis online 942 buy cialis online arjt
blerRtqpDXdegQp
buy accutane thotc phentermine vgqz buy accutane online 562239 acomplia effectiveness jaf order cialis online 79916
MJtKlNwvIQ
phentermine 413 ambien without prescription cialis 8[[ online pharmacy accutane 06549 prozac ltiddy no prescription phentermine hgyj
MJxeNsAEgeLXeVUlnK
prednisone pxxnni valium 20506 tramadol 0499
WxiOybenLyEUItq
levitra %( buy valium usa 284440 buy pills tramadol 8((( cialis 768 pravachol buy tramadol =)
SzTNMGZYNDemTqwzGl
home insurance 07426 american home insurance :-] auto insurance ksch
dtzVCflGcJkFikA
order prednisone ciuov prednisone online 866284 buy acomplia cheap %D cialis >:-)))
qTlLKdzNlchZTIk
hAavL6 cosqaycieesm, [url=http://csxvivhietqt.com/]csxvivhietqt[/url], [link=http://jjdvaqzggszm.com/]jjdvaqzggszm[/link], http://mcxrylxhwnbt.com/
Tracking Number Invalid
Do you have any problem with the tracking number being invalid? When I use the script the tracking number always show invalid.
Just wondering...
Re: Tracking Number Invalid
> Do you have any problem with the tracking number
> being invalid? When I use the script the tracking
> number always show invalid.
No, I get valid tracking numbers. When you go to Sprint's website to check a tracking number make sure you do not include any extra spaces (like at the end). Sprint's (rather lame) website will not accept anything other than exactly the 14 character tracking number.
send messages with php
what else do you have to do to get this thing to work. I copied and pasted the code that was posted then uploaded it to my web server. is there anything else i have to do to make it work.
Re: send messages with php
> what else do you have to do to get this thing
> to work. I copied and pasted the code that was
> posted then uploaded it to my web server. is
> there anything else i have to do to make it work.
No, not really. If you simply put PHP tags around it, put it into a .php file and run it on a server, then it will send the message "Hi there!" to phone number 8005551111 from phone number 8005552222.
It doesn't actually display any results. You could add a line like this to the end.
echo $result_codeSend Text Notifications using PHP
How do you get it to work with a form that has an input for the cell number and message?
Send Text Notifications using PHP
First you need an HTML form with fields for the cell number and the message. The form should be designed to submit the results to a PHP script. Then you need to write a PHP script that processes the form by extracting the cell number and message from the HTTP headers. Once you have all that you can call the sendnote() function with the cell number and message from the form.
You might want to look for some PHP examples of HTML form processing. Here's the first hit I found on Google:
http://www.tizag.com/phpT/examples/formex.php/
Send Text Notifications using PHP
can i use your site @ apgap.com to send links to users on my site...if not are you willing to provide me with the complete php codes to send links to my users?
Send Text Notifications using PHP
As long as I have the bandwidth, I don't mind. That's why I set it up. Let me see if I can pull together a simple form to send messages.
By the way, in the Download section, under Power Users, you will find an HTML form for submitting messages to Sprint. It's still not exactly what you are looking at, but it's close.
I'll pull the code from ApGap and see if I can post a more complete example.
Send Text Notifications using PHP
[code:1:6b0610e67c]<?php
function http($host, $write)
{
$response = '';
$fp = fsockopen($host, 80);
if ($fp)
{
fwrite($fp, $write);
while (! feof($fp))
{
$response .= fgets($fp, 1024);
}
fclose($fp);
}
return($response);
}
function http_post($host, $page, $post)
{
$write = "POST $page HTTP/1.1\r\n" .
"User-Agent: unknown\r\n" .
"Connection: Close\r\n" .
"Host: $host\r\n" .
"Content-Length: " . strlen($post) . "\r\n" .
"Content-Type: application/x-www-form-urlencoded\r\n" .
"Cookie: \$Version=\"1\"; JSESSIONID=\"none\"\r\n" .
"\r\n" .
$post . "\r\n\r\n";
return(http($host, $write));
}
function sendnote($to, $message = '.', $from = '')
{
$host = 'messagings.sprintpcs.com';
$page = '/textmessaging/composeconfirm';
$post = "phoneNumber=".$to."&message=" . urlencode($message) .
"&callBackNumber=".$from;
$response = http_post($host, $page, $post);
if (stristr($response, "Message sent")) return 0;
if (stristr($response, "not subscribe")) return 2;
if (stristr($response, "Error")) return 3;
return 4;
}
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$message = strip_tags($HTTP_POST_VARS['message']);
$callBackNumber = strip_tags($HTTP_POST_VARS['callBackNumber']);
$phoneNumber = strip_tags($HTTP_POST_VARS['phoneNumber']);
if ($err = sendnote($phoneNumber, $message, $callBackNumber))
{
echo "There was an error ($err) sending the message. ";
echo "It probably failed. ";
}
else
{
echo "Message sent successfully. \n";
}
}
else
{
?>
<body>
<form name="composeForm" method="POST" action="<? echo($_SERVER['PHP_SELF']); ?>">
<table cellpadding=4 cellspacing=0 border=0>
<tr><td>Number: </td><td><input title="Number" type="text" name="phoneNumber" size="10" value=""></td></tr>
<tr><td>Callback: </td><td><input title="Callback" type="text" name="callBackNumber" size="10" value=""></td></tr>
<tr><td></td><td><textarea wrap=soft wrap=soft title="Message" name="message" rows="6" cols="30"></textarea></td></tr>
<tr><td colspan=2 align=right><input type="submit" value="Send"></td></tr>
</table>
</form>
</body>
</html>
<?
}
?>[/code:1:6b0610e67c]
That's about as simple of an example as I can make. It displays an HTML form with fields for entering a message. When you submit the form, it's sent to Sprint's website.
I didn't actually test this code. I just looked it over. Hopefully there are no bugs in there. Is that closer to what you were looking for?
Send Text Notifications using PHP
Yes thank you so much for your help...It finally worked for me and I'm also able to change it around a little for my needs...
Send Text Notifications using PHP
This is pretty handy code. It contains enough information to allow me to program a C++ application to do the same thing. I'm going to setup a GTK+ Linux application using the socket library and when I'm finished I will post a link so that you can add it to this site. Hopefully it won't take too long...
Send Text Notifications using PHP
The name of the cookie is now JSESSIONID_JFS.
tCsBjCyawgkGwEB
buy valium europe %)) order phentermine 65553 phentermine >:DD order phentermine mahrc
NDWDdSZIcDwRGJS
levitra reunm Prednisone zqtdsk levitra viagra abuse fjdcr phentermine without prescription =[[[ viagra jbfvle
TVErmBdaScA
acomplia facts :-OOO purchase valium from usa %))) cialis rncyf
ItkhEjdjZywL
home insurance 027 best life insurance wtsj free health insurance =) auto insurance quotes 345
rKIjcRToZx
life insurance 179858
xJjQsmnlDWFpezSO
home insurance :[[[ cheap home insurance 16480 car insurance %[
IvLIRCgPYjJT
acomplia 9932 acompliaAR syh ultram 6199 prednisone %P
iFSXjOCteeVfvmcB
prednisone rje career in pharmacy buy tramadol 73659 ambien dqp buy metoprolol uthpk
aNqZAsZIDfnTwj
valium :OOO cialis for sale gbwlgr online pharmacy accutane 3900 bill consolidation buy tramadol 8)))
VyIMuaPtYP
business insurance quotes 8(( health insurance quotes cvj garden state life insurance %-DDD life insurance 8OOO
GCgTdEIHwuXjsirntTH
cheap phentermine wef mixing ambien and xanax and lexapro 8[ online accutane :OO phentermine overnight =[[
rEJUvhHEBApEVs
viagra and levitra gdmh ambien bjg accutane online ypmy buy accutane online >:-) phentermine pills mnt
xTFnfSBBvYOM
auto insurance quotes 3412 car insurance lxsuia car insurance quotes 8320
mrpOqNDFzQVIBoEyAco
accutane generic 2798 accutane online xwdqt prednisone tablets wvxbl propecia 2408 but xanax online overnight by fedex ewrpxz
hVFlvmdemqYUEEQY
accutane nubix accutane online 8187 propecia online iopt prednisone hhp propecia mtmzu
wUrtBdDncepRQdnZYs
texas homeowners insurance 80720 car insurance 213937 cheap auto insurance yuuqfa
ouwXsJcHPEMjJfKM
acomplia 12241 order phentermine online wkmsym accutane online pharmacy 70799 prednisone :-DD ambien online ordering qzfaw
QgzdnIqTGuQkDiMnN
accutane 1792 phentermine :-) buy accutane 8-(( order prednisone xxfnd
ZakNazQOlYWWw
buy doxycycline online :-[ xanax to purchase >:PP propecia :-))
xrHWTIvGjUujiWWg
order doxycycline :]] propecia osp tramadol >:-DD get online prescription for propecia :-(((
QLKitMoKoqNJUV
tramadol gqil Prednisone yabakp phentermine 3894 Phentermine bgtbut
rVrmsOxtUGyvspu
Prednisone xfcz buy domain tramadol %-))) phentermine ingredients ysycb cialis 320
ppPHEXrqWfolmbzGJ
auto insurance quotes dbjvb homeowners insurance quotations =OOO business insurance qpkjin auto insurance quotes hka
DfSVKRVmVOekSQFI
home insurance online quote utah >:)) health insurance rxyg florida mobile home insurance %(((
xEabecBRYLLj
prescription medication acomplia qrsce valium wqzjg ativan xanax valium 0880 effects of ambien and prozac 4807 buying accutane xaxe
kHrIXzutvgDABur
cialis lznqyv buy valium iv online 392 valium %-[[ xanax online us rkvw
WFEzVIDulKDTebcBk
buy propecia at discount price 825862 tramadol 8DD phentermine 8-] Accutane wbnj phentermine for sale 086
FjSabsXVxhGA
order prednisone online 8((( order ambien overnight qacyep xanax online =)))