mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
ImageNetworkTest0
This commit is contained in:
parent
4b4fd3b942
commit
79f7cd627a
@ -53,6 +53,12 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jsoup</groupId>
|
||||||
|
<artifactId>jsoup</artifactId>
|
||||||
|
<version>1.12.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package net.mamoe.mirai.utils;
|
||||||
|
|
||||||
|
import org.jsoup.Connection;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ImageNetworkUtils {
|
||||||
|
public static void postImage(String ukey, int fileSize, String g_uin,String groupCode, String img){
|
||||||
|
//http://htdata2.qq.com/cgi-bin/httpconn?htcmd=0x6ff0071&ver=5515&term=pc&ukey=” + 删全部空 (ukey) + “&filesize=” + 到文本 (fileSize) + “&range=0&uin=” + g_uin + “&groupcode=” + Group
|
||||||
|
StringBuilder builder = new StringBuilder("http://htdata2.qq.com/cgi-bin/httpconn?htcmd=0x6ff0071&ver=5515&term=pc");
|
||||||
|
builder.append("&ukey=")
|
||||||
|
.append(ukey.trim())
|
||||||
|
.append("&filezise=").append(fileSize)
|
||||||
|
.append("&range=").append("0")
|
||||||
|
.append("&uin=").append(g_uin)
|
||||||
|
.append("&groupcode=").append(groupCode);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Connection.Response response = Jsoup.connect(builder.toString())
|
||||||
|
.ignoreContentType(true)
|
||||||
|
.requestBody(img)
|
||||||
|
.followRedirects(true)
|
||||||
|
.userAgent("QQClient")
|
||||||
|
.header("Content-Length","" + fileSize)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
System.out.println(response.statusCode());
|
||||||
|
System.out.println(response.statusMessage());
|
||||||
|
System.out.println(response.body());
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user