Android simulated Login comment CSDN implementation code

Sometimes, as an unofficial app, it integrates all the official information, but now it needs to realize another function, that is, log in and comment on the official website. Unofficial apps do not know how the official website logs in and comments. Moreover, the larger the website, many obstacles are added to prevent such things from happening, However, we can provide you with a general way, which is a little time-consuming, but according to this method, basically all websites are free. Take CSDN for an experiment today.

1. Log in to CSDN

View its source code form:

Next, use xutils and jsup to get web page properties:

In this way, we not only get the dynamic ID of the web page, but also set it to the requestparams of the form to be submitted.

In this way, we regenerate a params1. At this time, all form information has been set in it. The following is a simulated Login:

Calling getlogincsdn will output the following information in the log:

2. Comment on CSDN blog

First, let's open a blog post and open httpwatch. Now enter information in the comment. Don't click Submit immediately. Open httpwatch first. Then submit and close, and we will get the following interface:

There are three submitted form data and a query string:

Let's start setting the relevant data of comments into requestparams:

Of course, there is no need for some data. In order to test, I set it according to the settings given in httpwatch:

The following log information will be output:

It returns 1 for success and 0 for failure. The only thing to explain is that the timeout I set is 15 seconds. You must know better than me that CSDN takes so long to comment on Web pages, not to mention mobile phones.

Look at the effect of the web page:

One of the more is the wrong publication of the China Super times.

This article is just a simulated Login and comment CSDN, and other websites are similar to this.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>