Implement BP machine with Delphi, mobile phone short message
Programming Xu Changyou
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.0accept: 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-cncontent-type: Application / X -www-form-urlencodedProxy-Connection: Keep-AliveUser-Agent: Mozilla / 4.0 (compatible; MSIE 5.5; Windows 98) Host: www2.scuta.edu.cnContent-Length: 87Pragma: no-cacheCookie: ASPSESSIONIDQGGGQHHE = ABGNNOJCIGOFCDLBIOLHKAFK normal server The head structure of the response is: 200 OK HTTP / 1.0 Description Submitted Data Success 3, the implementation of the program Delphi Delphi is easy to implement the above data submission, and it also supports Proxy, so on the Internet The same can be applied, 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 of 0: Callstr: = Callstr ' & Pager_Type = C '; 1: Callstr : = callstr '& pager_type = N'; end; callstr: = callstr '& firstname =' firstname.text; case RadioGroup2.ItemIndex of 0: 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 kilin nmhttp1.proxy: = edit1.text; nmhttp1.proxyport: = strt2.text); end; nmhttp1.get (callstr); end; Some paging (such as Run Xuncing can not use it GET request is implemented, it uses POST requests), use the same as the above phase, as the POST usage of NMHTTP: nmhttp1.inputfilemode: = false; nmhttp1.outputfilemode: = true; nmhttp1.reportlevel: = Stat us_Basic; If ifuseproxy.Checked then Begin NMHTTP1.Proxy: = Edit1.Text; NMHTTP1.ProxyPort: = StrToInt (Edit2.Text); End; With NMHTTP1.HeaderInfo do Begin Cookie: = Edit5.Text; LocalMailAddress: = Edit6.Text Odalprogram: = edit7.text; referer: = edit8.text; userid: = edit9.text; password: = edit10.text; end; // Put the data you want to submit first in Test.txt file: Format is STNID = A & Pageno =