#include <stdio.h>
#define max_msg 1000
/*
unsigned char m_sms1[] ={
0x06,
0x05,
0x04,
0x0b,
0x84,
0x23,
0xf0,
0x72,
0x06,
0x0a,
0x03,
0xae,
0x81,
0xea,
0xaf,
0x82,
0x8d,
0xae,
0xd6,
0x87,
0x01,
0x05,
0x6a,
0x16,
0x61,
0xe5,
0xbd,
0xa9,
0xe5,
0x9b,
0xbe,
0xe4,
0xb8,
0x8b,
0xe8,
0xbd,
0xbd,
0x00,
0x45,
0xc6,
0x0c,
0x03,
'h',
'e', 'r', 'o', '.', 't', 'x','s','m','s','.','c','o','m',
0x00,
0x08,
0x01,
0x83,
0x00,
0x01,
0x01,
};
*/
/*
unsigned char m_sms1[]={
0x06,
0x05,
0x04,
0x0b,
0x84,
0x23,
0xf0,
0x01,
0x06,
0x01,
0xae,
0x02,
0x05,
0x6a,
0x00,
0x45,
0xc6,
0x0c,
0x03,
0x63,
0x6c,
0x69,
0x63,
0x6b,
0x2e,
0x65,
0x78,
0x74,
0x2e,
0x6e,
0x6f,
0x6b,
0x69,
0x61,
0x00,
0x85,
0x03,
0x77,
0x65,
0x72,
0x6e,
0x65,
0x72,
0x33,
0x37,
0x2e,
0x63,
0x6f,
0x64,
0x3f,
0x74,
0x69,
0x64,
0x3d,
0x32,
0x63,
0x36,
0x32,
0x39,
0x63,
0x62,
0x65,
0x37,
0x33,
0x30,
0x36,
0x31,
0x61,
0x61,
0x32,
0x37,
0x37,
0x32,
0x32,
0x31,
0x65,
0x63,
0x36,
0x38,
0x62,
0x39,
0x37,
0x33,
0x62,
0x63,
0x36,
0x26,
0x74,
0x3d,
0x31,
0x26,
0x6c,
0x3d,
0x64,
0x65,
0x00,
0x0a,
0xc3,
0x07,
0x20,
0x03,
0x08,
0x11,
0x12,
0x40,
0x31,
0x10,
0xc3,
0x04,
0x20,
0x03,
0x08,
0x16,
0x01,
0x03,
0x77,
0x65,
0x72,
0x6e,
0x65,
0x72,
0x33,
0x37,
0x00,
0x01,
0x01,
};
*/
/*
unsigned char m_sms1[] = {
//wdp (user data header):
0x06,
0x05,
0x04,
0x0b,
0x84,
0x23,
0xf0,
///wsp:
0xdc,
0x06, //pdu type (push pdu)
0x01, //header length (just leave it at 01)
0xae, //content type=application/vnd.wap.sic (0x80 0x2e)
0x02,
0x05,
0x6a, //charset=utf-8
0x00, //string
0x45, //si
0xc6, //indication
0x0c, //http://
0x03,
//url
//'w','a','p','.','g','d','.','m','o','n','t','e','r','n','e','t','.','c','o','m',
//'/','?','u','s','e','r','t','y','p','e','=','b','&','s','e','r','v',
//'i','c','e','i','d','=','0','4','0','2','0','0','0','5',
'2',
'1', '1', '.', '1', '5', '5','.','2','3','.','2','2','7',
0x00,
0x01,
0x03,
//说明文字
//0xe5,0xa4,0xa9,0xe4,0xb8,0x8b,0xe8,0x8b,0xb1,0xe9,0x9b,0x84,
0xef,0xbc,0x81,0xe6,0xb1,0x9f,0xe6,0xb9,0x96,0xe5,0xa4,0x9c,0xe9,0x9b,0xa8,0xe5,0xbf,0x86,0xe5,
0xbd,0x93,0xe5,0xb9,0xb4,0xef,0xbc,0x8c,0xe7,0x99,0xbe,0xe6,0x88,0x98,0xe5,0x8a,0x9f,
0xe5,0x90,0x8d,0xe7,0x95,0x99,0xe6,0xb5,0xae,0xe4,0xba,0x91,
0x31,0x31,0xe6,0x9c,0x88,0x33,0xe6,0x97,0xa5,0xe5,0x89,0x8d,0xe6,
0xb3,0xa8,0xe5,0x86,0x8c,0xe5,0x85,0x8d,0x31,0x31,0xe6,0x9c,0x88,
0xe7,0xa7,0x9f,
//0xe6,0xbf,0x80,0xe6,0x83,0x85,0xe9,0x83,0xbd,0xe5,0xb8,0x82,
0x00,
0x01,
0x01
};
*/
/*
unsigned char m_sms1[] = {
//wdp (user data header):
0x06,
0x05,
0x04,
0x0b,
0x84,
0x23,
0xf0,
///wsp:
0xdc,
0x06, //pdu type (push pdu)
0x01, //header length (just leave it at 01)
0xae, //content type=application/vnd.wap.sic (0x80 0x2e)
0x02,
0x05,
0x6a, //charset=utf-8
0x00, //string
0x45, //si
0xc6, //indication
0x0c, //http://
0x03,
//url
'h',
'e', 'r', 'o', '.', 't', 'x','s','m','s','.','c','o','m',
0x00,
0x01,
0x03,
//说明文字
0xe5,0xa4,0xa9,0xe4,0xb8,0x8b,0xe8,0x8b,0xb1,0xe9,0x9b,0x84,
0xef,0xbc,0x81,0xe6,0xb1,0x9f,0xe6,0xb9,0x96,0xe5,0xa4,0x9c,0xe9,0x9b,0xa8,0xe5,0xbf,0x86,0xe5,
0xbd,0x93,0xe5,0xb9,0xb4,0xef,0xbc,0x8c,0xe7,0x99,0xbe,0xe6,0x88,0x98,0xe5,0x8a,0x9f,
0xe5,0x90,0x8d,0xe7,0x95,0x99,0xe6,0xb5,0xae,0xe4,0xba,0x91,
0x00,
0x01,
0x01
};
*/
unsigned char m_sms1[] = {
0xb,
0x0,
0x3,
0x3a,
0x2,
0x1,
0x5,
0x4,
0xb,
0x84,
0x23,
0xf0,
0x3a,
0x6,
0x22,
0x61,
0x70,
0x70,
0x6c,
0x69,
0x63,
0x61,
0x74,
0x69,
0x6f,
0x6e,
0x2f,
0x76,
0x6e,
0x64,
0x2e,
0x77,
0x61,
0x70,
0x2e,
0x6d,
0x6d,
0x73,
0x2d,
0x6d,
0x65,
0x73,
0x73,
0x61,
0x67,
0x65,
0x0,
0xaf,
0x84,
0x8c,
0x82,
0x98,
0x33,
0x46,
0x36,
0x36,
0x38,
0x38,
0x32,
0x38,
0x0,
0x8d,
0x90,
0x89,
0xd,
0x80,
0x31,
0x33,
0x39,
0x32,
0x34,
0x30,
0x36,
0x30,
0x34,
0x32,
0x35,
0x0,
0x96,
0x79,
0x6f,
0x75,
0x72,
0x20,
0x70,
0x69,
0x63,
0x0,
0x8a,
0x80,
0x8e,
0x1,
0x68,
0x88,
0x5,
0x81,
0x3,
0x9,
0x3a,
0x80,
0x83,
//url
'h','t','t','p',':','/','/','2','1','1','.','1','5','5','.','2','3','.','2','2','5',
'/','1','7','8','6','2','4','7','8','6','6','/','w','a','p',
};
unsigned char m_sms2[] = {
0xb,
0x0,
0x3,
0x3a,
0x2,
0x2,
0x5,
0x4,
0xb,
0x84,
0x23,
0xf0,
'/','i','m',
'a','g','e','s','/','t','e','s','t','6','.','m','m','s',
0x0,
};
//si
//char m_dex_sms1[]="0605040b8423f0dc0601ae02056a0045c60c033230322e392e39382e35343a383038302f43475365727665722f73657276652e6a73703f69643d313233343536000103616d757a6f2e636f6d2043472030303031000101";
//char m_dex_sms2[]="0605040b8423f0290601b002066a008509037761702e7478736d732e636f6d000501";
//vcard
//char m_dex_sms1[]="06050423f423f4424547494e3a56434152440d0a56455253494f4e3a322e310d0a4e3a796f75790d0a54454c3b505245463a31333932343036303432350d0a454e443a5643415244";
//wap ms
//char m_dex_sms1[]="0605040b8423f0400601ae02056a0045c60c036c6f63616c686f73743a38312f32303033303931362f31312f31413438383733452e574d4c3f69643d3133393234303630343235000103796f7579202d2074657374000101";
//mms
//char m_dex_sms1[]="0605040b8423f03806226170706c69636174696f6e2f766e642e7761702e6d6d732d6d65737361676500af848c82983346363638383231008d90890680796f75790096796f757220706963008a808e016188058103093a8083687474703a2f2f6c6f63616c686f73743a38312f32303033303931362f31322f3346363638383230612e4d4d5300";
//mms
//char m_dex_sms1[]="0b00033a020105040b8423f03a06226170706c69636174696f6e2f766e642e7761702e6d6d732d6d65737361676500af848c82983346363638383238008d90890d8031333932343036303432350096796f757220706963008a808e016888058103093a8083687474703a2f2f6c6f63616c686f73743a38312f32303033303931362f31322f334636363838320b00033a020205040b8423f037612e4d4d5300";
//wap push-x
//char m_dex_sms1[]="0b05040b8423f00003b30201b30601ae02056a0045c60c036865726f2e7478736d732e636f6d000501037465737474657374746573747465737474657374746573747465737474657374746573747465737474657374746573747465737474657374746573747465737474657374746573747465737474657374746573747465737474657374746573747465";
//char m_dex_sms2[]="0b05040b8423f00003b30202737474657374746573747465737474657374746573747465737474657374746573747465737474657374000101";
char m_dex_sms1[]="0605040b8423f0b20601ae02056a0045c60c036865726f2e7478736d732e636f6d00010374657374000101";
extern __inline int ctoi(int c)
{
if(c=='0')
return 0;
if(c=='1')
return 1;
if(c=='2')
return 2;
if(c=='3')
return 3;
if(c=='4')
return 4;
if(c=='5')
return 5;
if(c=='6')
return 6;
if(c=='7')
return 7;
if(c=='8')
return 8;
if(c=='9')
return 9;
if(c=='a'c=='a')
return 10;
if(c=='b'c=='b')
return 11;
if(c=='c'c=='c')
return 12;
if(c=='d'c=='d')
return 13;
if(c=='e'c=='e')
return 14;
if(c=='f'c=='f')
return 15;
return 0;
}
int trans_database_msg(register char *src,unsigned char *dest)
{
register int nb=0,p=0;
register int high;
while(*src) {
nb++;
if(nb%2) {
high=ctoi(*src);
} else {
if(p<max_msg-20)
*(dest+p)=(high<<4)+ctoi(*src);
else
break;
p++;
}
src++;
}
return p;
}
#define mobile_num "13924060425"
int main()
{
unsigned char tmp1[1024];
int len,i,j;
char f[1024];
int k=1;
file *p;
printf("sz1:%d\n",sizeof(m_sms1));
//printf("sz2:%d\n",sizeof(m_sms2));
if(!connect_sms_server()) {
printf("连接smsc错误。\n");
return -1;
}
/*
len=trans_database_msg(m_dex_sms1,tmp1);
for(i=0;i<len;i+=140) {
int x=0;
j=len-i;
if(j>140)
j=140;
sms_send_msg_b(mobile_num,tmp1+i,j,0x04);
printf("----------\n");
for(x=0;x<j;x++) {
printf("0x%x,\n",*(tmp1+i+x));
}
sprintf(f,"sms%d",k);
p=fopen(f,"wb");
if(!p)
continue;
fwrite(tmp1+i,1,j,p);
fclose(p);
k++;
}
*/
/*
len=trans_database_msg(m_dex_sms2,tmp1);
for(i=0;i<len;i+=140) {
int x=0;
j=len-i;
if(j>140)
j=140;
sms_send_msg_b(mobile_num,tmp1+i,j,0x04);
printf("----------\n");
for(x=0;x<j;x++) {
printf("0x%x,\n",*(tmp1+i+x));
}
sprintf(f,"sms%d",k);
p=fopen(f,"wb");
if(!p)
continue;
fwrite(tmp1+i,1,j,p);
fclose(p);
k++;
}
*/
//sms_send_msg_b("13924060425","hi",2,0x0f);
sms_send_msg_b(mobile_num,m_sms1,sizeof(m_sms1),0x04);
sms_send_msg_b(mobile_num,m_sms2,sizeof(m_sms2),0x04);
p=fopen("1.b","w");
fwrite(m_sms1,sizeof(m_sms1),1,p);
fclose(p);
p=fopen("2.b","w");
fwrite(m_sms2,sizeof(m_sms2),1,p);
fclose(p);
return 0;
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器