Kaixin.com plug-in Development Note

Source: Internet
Author: User
Preparations for creating a web game plug-in:
1) be patient
2) familiar with HTML, JavaScript, especially form
3) familiar with HTTP protocol, especially cookie, URL encoding, post, and get content format
4) familiar with the game itself, can abstract the optimal mathematical model for making money/upgrading
5) You can use either Python or C # to master a language #
6) Some packet capture tools, such as fiddler

Okay. Let's take an example. kaixin.com is competing for a parking space.

First, let's see how a normal user plays the game.
1) input in the browserWww.kaixin001.com, Enter the user name and password, click to log on
2) After logging in, select "parking space competition" on the left to enter the parking space competition
3) Check out who is in my parking space and paste them one by one.
4) Check the parking time of your car for 15 minutes, and find an empty and non-free parking space.
5) log out of kaixin.com and close the browser.

Let's seeProgramHow to Implement 1-6.
1) log on to kaixin.com.
With the help of Fiddler, we know that the login is to submit form to/login. php, the post content is url = % 2f & Email = xxx@xxx.com & Password = xxx
C # Can Be Used to conveniently complete the post operation, get the server's return, and then find a keyword in the returned content to determine whether the login operation was successful. (For example, I am looking for "<title> my homepage-kaixinnet </title> ")

2) login to the parking space
This is a get operation. The URL is/APP. php? Aid = 1040.
The user name and password are not provided here. How can the server know which user it is? Cookie plays its role here.
In C #, the cookie is stored by a new cookiecontainer, which is used by all cookiecontainer of httpwebrequest.
Now, after obtaining this page, we can get a lot of information: (the information is in JSON format)
A) friend list, the status of each friend (online/full parking space)
B) your own garage information, which of your friends have stopped and how much they have earned.
C) Information about your own car, how many cars, Where are you parked, and how much are you earning?
Based on this information, we can get a parking list (list of friends who are not satisfied with the parking space)

3) Post
the post is a post operation, and the URL is/parking/post. in PHP, the content is verify = xxx & parkid = YYY & P = 1 & _ =
parkid is easy to understand and can be obtained directly from the garage information. How can we get verify?
my first response was that the cookie data was obtained through some calculation. However, after reading the HTML for login to the parking space, I found that verify was written like this:
...

4) parking space
This operation is a little complicated. You can analyze the specific HTTP request. The analysis result is as follows:
A) Is it a free parking space?
In JavaScriptCode:
V_park_free = (v_parkid> 16) & 0xff;
If (v_park_free)
{
V_mycar + = 'free parking space ';
}
Else
{
V_mycar + = 'private seat ';
}
C. Read the neighbor's garage information.
URL:/parking/neighbor. php
Post content: Verify = xxx & puid = YYY & _ =
D. Read the neighbor's garage information.
URL:/parking/user. php
Post content: Verify = xxx & puid = YYY & _ =
E) parking
URL:/parking/park. php
Post content: Verify = xxx & park_uid = xxx & parkid = xxx & carid = xxx & neighbor = xxx & A = 1 & first_fee_parking = 0 & _ =

5) log out
Get URL:/login/logout. php

Congratulations! You have understood all the basic operations.

^_^ I will give you a rough idea about this.

Analyze the implementation of web games.
If Ajax is used for implementation, it is good. You can analyze its HTML and JS, and use the viewpage plug-in of aoyou,
In general, Ajax uses JSON data to interact with the client on the server, and then finds the JS Code corresponding to a function, that is, Ajax. Post (URL ,...
Write down this URL
Log on to the game with httpwebrequest, and then obtain the URL post data from the top.

The most troublesome part is the refresh mechanism. For example, if there are n functions and m controls on the corresponding interface, you may need n + threads to refresh... this does not mean that a lot of data can be obtained only when certain conditions are met...

In general, several functions are relatively simple. If n is used, it will be troublesome.
. Net3.5 provides JSON serialization and deserialization functions, which are easy to use. You can work by setting up a data binding mechanism and refresh mechanism.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.