Current location: Hot Scripts Forums » Programming Languages » PHP » Need help in send some value through a URL for send SMS


Need help in send some value through a URL for send SMS

Reply
  #1 (permalink)  
Old 09-11-06, 06:20 AM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Need help in send some value through a URL for send SMS

Hi!

I would like to send SMS from our site through a company's server who has tha protocol installed on their server. they have provided me a php script and html page coding i have tried them but its not working.(giving parse error on line no.3)

The basic work is, its should take all from data and pass(redirect) the data in to there site from our site in form of query string as follows:

http://66.36.229.70:8800/?user=XXXX&...honeNumber=919
820884 064&Text=Testmessage9&Sender=k****ij

when this will generated the sms will go through the above site and a successfuly sent message will be displayed.

The code they have provide us as follows:

html code:

Code:
<HTML>
<HEAD><TITLE>Send SMS</TITLE></HEAD>
<BODY>
<form method="post" action="sendsmsscript.php">
<table border="1">
<tr>
<td>Mobile Number:</td>
<td><input type="text" name="phone" size="40"></td>
</tr>
<tr>
<td valign="top">Sender:</td>
<td><input type="text" name="sender" size="40"></td>
</tr>
<tr>
<td valign="top">Text Message:</td>
<td><textarea name="text" cols="80" rows="10"></textarea>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Send">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>

php code:

file name sendsmsscript.php

<?
*
PHP Code:

function SendSMS($host$port$user$password$phoneNoRecip
$msgText$msgSender) {
 
    
$fp fsockopen($host$port$errno$errstr);
    if (!
$fp) {
        echo 
"errno: $errno \n";
        echo 
"errstr: $errstr\n";
        return 
$result;
    }
   
fwrite($fp"GET /?Phone=" rawurlencode($phoneNoRecip) . "&Text=" rawurlencode($msgText) . "&Sender=" rawurlencode($msgSender) . "
 
HTTP/1.0\n"
);
    if (
$user != "") {
       
$auth $user ":" $password;
       
$auth base64_encode($auth);
       
fwrite($fp"Authorization: Basic " $auth "\n");
    }
    
fwrite($fp"\n");
 
    
$res "";
 
    while(!
feof($fp)) {
        
$res .= fread($fp,1);
    }
    
fclose($fp);
   
 
    return 
$res;
}
 

if (isset(
$_REQUEST['phone'])) {
   if (isset(
$_REQUEST['text'])) {
   if (isset(
$_REQUEST['sender'])) {
      
$x   SendSMS("66.36.229.70"8800"XXXXX""XXXXX"$_REQUEST['phone'], $_REQUEST['text'], $_REQUEST['sender']);
      echo 
$x;
   }
   else {
      echo 
"ERROR : Message not sent -- Text parameter is missing!\r\n";
   }
}
else {
   echo 
"ERROR : Message not sent -- Phone parameter is missing!\r\n";
   }
}
else {
   echo 
"ERROR : Message not sent -- Sender parameter is missing!\r\n";
}
 
?> 

Also they can't help us any technical help regarding php.

If anyone can tell me what to do take to work it properly.

Thanks in advance.

Last edited by nico_swd; 09-11-06 at 11:57 AM. Reason: Please use PHP wrappers when posting php code.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send Unlimited FREE SMS to Anyone In The World!!! latheesan General Advertisements 8 06-23-09 03:13 AM
send sms queso8 PHP 2 05-18-06 07:22 AM
php script to send and receive sms through kannel gateway sephad Script Requests 0 01-30-06 07:53 AM


All times are GMT -5. The time now is 07:28 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.