Created
June 26, 2009 07:55
-
-
Save ankurs/136364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sms archiver for pys60 - Project 21 | |
# sms.py | |
import inbox | |
import urllib,urllib2 | |
i = inbox.Inbox() | |
m = i.sms_messages() | |
print 'hello' | |
for a in m: | |
post = {'number' : i.address(a).encode('utf-8'), | |
'msg' : i.content(a).encode('utf-8'), | |
'time' : i.time(a), | |
'unread': i.unread(a), | |
'msgid':a } | |
request = urllib2.Request('https://192.168.1.2/tt/p21/',urllib.urlencode(post)) | |
req = urllib2.urlopen(request) | |
print req.read() | |
# php file | |
<?php | |
$con = mysql_connect('','',''); | |
mysql_select_db('p21',$con); | |
if (isset($_POST['number']) and isset($_POST['msg']) and isset($_POST['time']) and isset($_POST['unread']) and isset($_POST['msgid'])) | |
{ | |
$msg=mysql_real_escape_string($_POST['msg']); | |
mysql_query("insert into test (number,msg,time,unread,msgid) values('{$_POST['number']}','{$msg}','{$_POST['time']}','{$_POST['unread']}','{$_POST['msgid']}')",$con) or die(mysql_error()); | |
echo "done"; | |
} | |
else | |
{ | |
echo "nope"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment