This is written last year, a Delphi program, there was a friend of Ningbo let me help him write a software, requirements are as follows: can be in XXXX website of each transaction area, realize automatic posting.
XXXX is a game point card trading site, they are divided according to the province of the trading area, information publishers can only in one province to publish information. Of course, they may also be for some purpose, such as preventing the spread of information. Publishers publish information on the page has a graphics verification code, only fill in the correct code to complete the process.
At that time he has been used, whether it is still in use is unknown, the code to put out the pure is to communicate with everyone to learn, do not do evil.
Login site, automatically fill in the Web page data, and submit, this function is relatively simple, I think we will all, I just give an example:
First, you embed a standard WebBrowser control on the form (another WebBrowser control is used in the program, but it can be interchanged), navigate a URL, and then access it through an OLE object.
For example, there is a button on the page with ID Btnok, so you can access:
try
o := EmbeddedWB1.OleObject.document.all.item('btnok',0);
o.click;
except
txtError.caption := '当前页面未发现<确认提交>的输入位置,请核对!';
end;
A more complex area is mainly the identification of the verification code:
Thanks to this site's verification code picture is relatively simple, 4 characters, although there is interference color, there is noise, there is a character adhesion, and with a certain rotation, but only the number, no letters and Chinese characters, otherwise trouble big, have to do a complete OCR system.
The image processing process is as follows:
The identification simulation process is as follows:
Contrast similarity is the difficulty of recognition, I here because the picture is relatively simple, so more labor-saving. For more complex image recognition, you can build a mathematical model, the image and template into a matrix, according to the matrix transformation and rotation of the similarity comparison, interested buddies can be more in-depth understanding.
Source code I put it into the resources to go, we can download free. You laughed, dephi7 prepared, at that time the recognition rate of almost 80%.
This article is from the "Web Architecture Home" blog, please be sure to keep this source http://wangzebin.blog.51cto.com/653300/128549
This article supporting source code