Skip to content

Commit 6e9fc23

Browse files
committed
2 parents eeb641a + cec04a7 commit 6e9fc23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1017
-301
lines changed
21.8 KB
Binary file not shown.
31.4 KB
Binary file not shown.

JAVA/java-proj请求.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
private String post(){
2+
String userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36";
3+
long timeStamp=Calendar.getInstance().getTimeInMillis();
4+
String cookieStr="weimao_session=s%3AqMw2MW91Ja1BNVF0V2219smkXk7KAoR1.BriuuIb%2BZ2q2je%2FIMjmBw4gI7ibevI58pv7KcqD5R8g; Hm_lvt_c99fc61dc621e6b02c50ffce880b90b7=1504077167,1504158671,1505197068; Hm_lpvt_c99fc61dc621e6b02c50ffce880b90b7="+timeStamp/1000;
5+
CloseableHttpClient httpClient= HttpClients.custom()
6+
.setUserAgent(userAgent)
7+
.build();
8+
9+
HttpPost httpPost=new HttpPost(url);
10+
List<NameValuePair> params=new ArrayList<>();
11+
params.add(new BasicNameValuePair("type","operation"));
12+
httpPost.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
13+
14+
List<Header> headerList=new ArrayList<>();
15+
headerList.add(new BasicHeader("Cookie",cookieStr));
16+
Header[] headers=new Header[headerList.size()];
17+
for(int i=0;i<headerList.size();i++){
18+
headers[i]=headerList.get(i);
19+
}
20+
21+
httpPost.setHeaders(headers);
22+
try{
23+
HttpResponse resp= httpClient.execute(httpPost);
24+
HttpEntity entity=null;
25+
if(resp!=null){
26+
entity= resp.getEntity();
27+
}
28+
29+
if(entity!=null) {
30+
InputStreamReader inReader=new InputStreamReader(entity.getContent(),Consts.UTF_8);
31+
BufferedReader buf=new BufferedReader(inReader);
32+
StringBuilder sb = new StringBuilder();
33+
34+
String line=buf.readLine();
35+
while(line!=null){
36+
sb.append(line);
37+
line=buf.readLine();
38+
}
39+
inReader.close();
40+
41+
return sb.toString();
42+
}
43+
}catch(IOException ex){
44+
ex.printStackTrace();
45+
}
46+
47+
return null;
48+
}

JAVA/post2-编码解决.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
private String post(){
2+
String userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36";
3+
long timeStamp=Calendar.getInstance().getTimeInMillis();
4+
String cookieStr="weimao_session=s%3AqMw2MW91Ja1BNVF0V2219smkXk7KAoR1.BriuuIb%2BZ2q2je%2FIMjmBw4gI7ibevI58pv7KcqD5R8g; Hm_lvt_c99fc61dc621e6b02c50ffce880b90b7=1504077167,1504158671,1505197068; Hm_lpvt_c99fc61dc621e6b02c50ffce880b90b7="+timeStamp/1000;
5+
CloseableHttpClient httpClient= HttpClients.custom()
6+
.setUserAgent(userAgent)
7+
.build();
8+
9+
HttpPost httpPost=new HttpPost(url);
10+
List<NameValuePair> params=new ArrayList<>();
11+
params.add(new BasicNameValuePair("type","operation"));
12+
httpPost.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
13+
14+
List<Header> headerList=new ArrayList<>();
15+
headerList.add(new BasicHeader("Cookie",cookieStr));
16+
Header[] headers=new Header[headerList.size()];
17+
for(int i=0;i<headerList.size();i++){
18+
headers[i]=headerList.get(i);
19+
}
20+
21+
httpPost.setHeaders(headers);
22+
try{
23+
HttpResponse resp= httpClient.execute(httpPost);
24+
HttpEntity entity=null;
25+
if(resp!=null){
26+
entity= resp.getEntity();
27+
}
28+
29+
if(entity!=null) {
30+
InputStreamReader inReader=new InputStreamReader(entity.getContent(),Consts.UTF_8);
31+
BufferedReader buf=new BufferedReader(inReader);
32+
StringBuilder sb = new StringBuilder();
33+
34+
String line=buf.readLine();
35+
while(line!=null){
36+
sb.append(line);
37+
line=buf.readLine();
38+
}
39+
inReader.close();
40+
41+
return sb.toString();
42+
}
43+
}catch(IOException ex){
44+
ex.printStackTrace();
45+
}
46+
47+
return null;
48+
}
36.9 KB
Binary file not shown.

JAVA/some_stuff_study/codes/.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JAVA/some_stuff_study/codes/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JAVA/some_stuff_study/codes/.idea/libraries/Maven__org_apache_velocity_velocity_engine_core_2_0.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JAVA/some_stuff_study/codes/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JAVA/some_stuff_study/codes/.idea/misc.xml

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)