Implement BP machine with Delphi, mobile phone short message
Many people must have used OICQ, they must have used its BP mobile phone short message, mobile phone short message, programmed friends must want to achieve this function, if your program can send it to the mobile phone, send it to the BP machine to be cool. Now I will introduce a feasible method. First, the principle is different from the two sides of OICQ to communicate the paging function on the Internet, which can send text information to the real pager. As long as you can go online, you can send your own hand, and send the information anytime, anywhere, even if you are abroad, you can use it to send information to the domestic friends, and don't pay international long distance costs, is it convenient and more convenient! Second, the analysis is now online service, web page paging is a commonly used. It is a paging system to access the home page of the search station on the Internet and then tap the page of the hoping station. So we only need to use the HTTP protocol to realize the network paging. The following brief introductions to the HTTP protocol: HTTP is completed in HTTP. (Request 10,000-dimensional webpage) 2) Head (reading a 10,000-dimensional web page) 3) PUT (request a storage web page) 4) POST (additional named resource) 5) DELETE (Delete W / Web) 6) LINK (Connecting two existing resources) 7) Unlink (disconnecting two existing resources) The answer status code for use in http is: (* represents a number of 0-9) 1. 1 ** (Information) 2. 2 ** (success) 3.4 ** (client error) 4.5 ** (server error) actually we want to implement, only POST, GET request, can receive normal response. POST can be used to pass the data input by the user in a data stream to the CGI program, and the CGI takes the corresponding length of data stream information through the Contect-Length environment variable. The POST request format is as follows: post http://www2.scuta.edu.cn/stu/chatroom/check.asp http / 1.0 accept: image / gif, image / x-xbitmap, image / jpeg, image / pjpeg, Application / VND.MS-POWERPOINT, Application / VND.ms-Excel, Application / Msword, * / * Referr: http://www2.scuta.edu.cn/stu/ ACCEPT-LANGUAGE: EN-CN Content-Type: Application / X-WWW-FORM-URLENCODED PROXY-Connection: Keep-Alive User-Agent: Mozilla / 4.0 (Compatible; Msie 5.5; Windows 98) Host: www2.scuta.edu.cn Content-Length: 87 Pragma: No-Cache Cookie : Aspsessionidqggqhhe = ABGNNOJCIGOFCDLBIOLHKAFK server The head structure of the normal response is: 200 OK HTTP / 1.0 Description Submitted Data Success 3, the implementation of the program Delphi is easy to implement the above data submit, and it also supports Proxy, This can be applied as the same as the Internet access, and it is not used to send a message to the Socket5 agent in OICQ.
Create a form, join the component a ComboBox, named CallTo, used to store the paging object, such as the national letter to the paging of 95908, 98035, 98052, 98038, 99055, 98060, 98061 , 98051, 98003, 99062, 99016, 99017, 99018, 99019, 99046, 99076; Add Item Edit, named tonumber, indicating a paging number; add component Radiogroup, named Radiogroup1, CAPTION Chanted to play the type, Items Add two Item, the Chinese machine, the digital machine; add the component edit, named firstname, used to represent the last name of the pagrace; add the component RadioGroup, named RadioGroup2, and CAPTION is set to paging people gender, Items join two, Mr., Miss; add component MEMO, named CallMSG, used for input information (Note: For digital information); add component nmhttp, named nmhttp1; add Checkbox, named ifuseProxy, used for Determine if you use a proxy server; add two EDIT components, used for software proxy server addresses, proxy server ports, and finally join the command button, and CAPTION is set to "Send".
Now use the national credit paging as an example, it can be implemented with the GET request, the program code of the "Send" button is as follows: Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); var callstr: string; begin callstr: = 'http: // tips.gxspace.com/cgi-bin/tips/webpaging?stn_id=' callto.Text '&page_no=' tonumber.Text;case RadioGroup1.ItemIndex of0: callstr: = callstr '& pager_type = C'; 1: callstr: = callstr '& pager_type = N'; end; callstr: = callstr '& firstname =' firstname.text; case RadioGroup2.ItemIndex of0: callstr: = callstr '& title = 0'; 1: callstr: = callstr '& title = 1' ; end; callstr: = callstr '& msg =' callmsg.Text '& answer = null & B1 = transmits a paging'; NMHTTP1.InputFileMode: = FALSE; NMHTTP1.OutputFileMode: = FALSE; NMHTTP1.ReportLevel: = Status_Basic; If ifuseproxy.Checked Thenbeginnmhttp1.proxy: = edit1.text; nmhttp1.proxyport: = start (edit2.text); end; nmhttp1.get (callstr); end; Some paging (such as Run Xun can not be implemented with the above GET request, it POST request use), using the above or less, as described below in a POST usage NMHTTP: NMHTTP1.InputFileMode: = False; NMHTTP1.OutputFileMode: = True; NMHTTP1.ReportLevel: = Status_Basic; If ifuseproxy.Checked thenBeginNMHTTP1.Proxy : = Edit1.text; nmhttp1.proxyport: = Strtoint (Edit) 2.Text); End; With NMHTTP1.HeaderInfo do BeginCookie: = Edit5.Text; LocalMailAddress: = Edit6.Text; LocalProgram: = Edit7.Text; Referer: = Edit8.Text; UserID: = Edit9.Text; Password: = Edit10.Text; End; // Put the data you want to submit first in the Test.txt file: format is stnid = a & Pageno = 123456 .... nmhttp1.post ('http://www.wocall.com/script/ ZBWebCall.asp ',' Test.txt ');