如何刷CSDN博客的评论数
见各种。如图所示的cookies
导入Java . io . buffered reader;
导入Java . io . io exception;
导入Java . io . inputstream;
导入Java . io . inputstreamreader;
导入Java . io . output stream;
导入Java . io . output streamwriter;
导入Java . net . httpurl connection;
导入Java . net . malformedurexception;
导入Java . net . URL;
导入Java . net . URL connection;
导入Java . util . concurrent . executorservice;
导入Java . util . concurrent . executors;
导入Java . util . concurrent . time unit;
导入com . cookies . del cookies . threada;
公共类HttpGetRequest
{
公共静态void doPost()抛出IOException
{
String参数= " commentid = & amp内容=HTTP测试& ampreplyId = ";
URL url =新URL("ment/submit?id = 50440123”);
URL connection connection = URL . open connection();
HttpURLConnection ");
/u 013256816/article/details/50440123”);
httpurlconnection . setrequestproperty("用户代理"," Mozilla/5.0(Windows NT 6.1;WOW64) AppleWebKit/537.36 (KHTML,像壁虎)Chrome/46 . 0 . 2490 . 71 Safari/537.36”);
OutputStream outputStream = null
output streamwriter output streamwriter = null;
InputStream inputStream = null
InputStreamReader InputStreamReader = null;
BufferedReader reader = null
string buffer result buffer = new string buffer();
String tempLine = null
尝试{
output stream = httpurlconnection . get output stream();
output streamwriter = new output streamwriter(output stream);
output streamwriter . write(parameter data . tostring());
output streamwriter . flush();
system . out . println(httpurlconnection . getresponsecode());
inputStream = httpurlconnection . getinputstream();
inputStreamReader = new inputStreamReader(inputStream);
reader = new buffered reader(inputStreamReader);
while((tempLine = reader . readline())!= null) {
result buffer . append(tempLine);
}
}最后{
if (outputStreamWriter!= null) {
output streamwriter . close();
}
if (outputStream!= null) {
output stream . close();
}
如果(读者!= null) {
reader . close();
}
if (inputStreamReader!= null) {
inputstreamreader . close();
}
if (inputStream!= null) {
inputstream . close();
}
}
system . out . println(result buffer . tostring());
}
静态类ThreadA实现Runnable{
int sleepTime
公共线程A(int sleepTime)
{
this . sleep time = sleep time;
}
@覆盖
公共无效运行()
{
while(真)
{
尝试
{
doPost();
}
catch (IOException e1)
{
e 1 . printstacktrace();
}
尝试
{
时间单位。毫秒.睡眠(this . sleep time);
}
catch(中断异常e)
{
e . printstacktrace();
system . out . println(thread . current thread()。getName()+"已停止!");
打破;
}
}
}
}
公共静态void main(String[] args)引发IOException
{
ExecutorService exec = executors . newcachedthreadpool();
for(int I = 0;我& ltRuntime.getRuntime()。available processors();i++)
{
Thread Thread = new Thread(new ThreadA(1000));
exec.execute(线程);
}
exec . shut down();
}
}
用自己的cookie替换上面的cookie可以添加评论,用别人的cookie替换也可以增加csdn的点数。