FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to store sms in database and use it





bukaida
I want the sms functionality in my website.Not a traditional one but in a bit different way--

The SMS gateway should be able to identify the sender number, message and sending time. These information should be stored in a mysql database so that they can be used by other php programs.

I am using OZEKI's HTTP SMS gateway which returns these informations in a url in the format
sender={$SENDER}&receiver={$RECEIVER}&message={$MSG}&receivedtime={$RECEIVEDTIME}.
I can also specify the php page in localhost where this information will go through this software. But the problem is how to accept this information?who and when this php page will be called?can a php header or html meta solve the problem? I have no idea of accepting a real time information in php variable.If I can accept them in php page, then through an insert query, I can insert them in database and my problem will be solved. OZEKI has a detail procedure for this purpose for it's paid version but those parameters do not apply here. Please help.
Question
rvec
if you make this the url:
http://www.example.com/sms/index.php?sender={$SENDER}&receiver={$RECEIVER}&message={$MSG}&receivedtime={$RECEIVEDTIME}

you can get the values in index.php with $_GET['sender'], $_GET['receiver'], $_GET['message'] and $_GET['receivedtime'].

But you should make sure normal users can't access the file, cause they could easily add info to the database this way. You can protect it with a .htaccess file that only accepts input from the gateway ip.
bukaida
I have not made this url. This is the format by which the OZEKI sms gateway is trying to pass the information to a php page defined in the path inside the software. But that page is not automaticaly opening after receiving the data even if it is existing in the specified path(The page has to be created by the user). I have used all possible super globals viz $_POST, $_GET, $_SESSION. Nothing worked.
rvec
it sends the stuff to an url, but you can't change the url?
That sounds odd, but I don't think it has anything to do with php in that case.
bukaida
You can specify where the output will be sent in the software but that doesnot help in anyway.I am attaching the screenshots for easy analyzing. Please view the original size to read the texts inside clearly.



rvec
I don't really understand what they mean with server and client, but it looks like it is working with either get or post.
rvec
I don't really understand what they mean with server and client, but it looks like it is working with either get or post.

edit I tried it out myself, and I used these settings:

this is http://localhost/sms/getresponse.php

Code:
<?php
$filename = 'sms.txt';
foreach ($_GET as $a) {
   $somecontent .= $a;
}
foreach ($_POST as $a) {
   $somecontent .= $a;
}
if (is_writable($filename)) {
    if (!$handle = fopen($filename, 'a')) {
         exit;
    }
    if (fwrite($handle, $somecontent) === FALSE) {
        exit;
    }
    fcl_ose($handle); //change that to fclose, but frihost somehow throws an error if I put that there
}
?>


I got all messages that where in the phone's inbox in sms.txt so at least something is working.

this is the client url: http://localhost/sms/getresponse.php?sender=$SENDER&
receiver=$RECEIVER&msg=$MSG&recvtime=$RECEIVEDTIME&
msgtype=$TYPE&gsmsms=$GSMSMS

and on the special tab I selected get. But your version looks a bit different, I think you don't have the newest version.
bukaida
Thanx man, trying to get the latest version. But can it be stored in database instead of file?
rvec
sure, if you know any php you can use mysql and write a script to store it there, but I think there also is a mysql plugin to directly put it in there.

edit: http://www.ozeki.hu/index.php?ow_page_number=535
frih
i want to see your sms website ......can you please give its url.....

actually i want to create my own sms website...can anybody please help me?
rvec
-close-
please keep it in your own topic
Related topics
News management system...
Which is the best Mobile phone
sms jokes
sms jokes
Database for Dentists
Need Expert help in php-mysql
Download database.
Change database collation type
Uploading...
SQL datatype
Storing Files Off Line
What MySQL Data type would you use to store a Webpage
Do you go to record stores?
Storing A Lot of Values Using Sessions
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.