利用淘宝api获取自定义吱口令
import java.util.Scanner;
import java.net.URL;
import java.net.MalformedURLException;
import java.net.URLConnection;
import java.io.IOException;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.List;
public class Main
{
public static void main(String[] args)
{
String s ="logo=http://z1.ourpast.cn/love/img/26.gif&text=铁头娃打爆你的头";
System.out.println(getstrings(s).replaceAll("null",""));
}
public static String getstrings(String s){
String result = null;
BufferedReader in =null;
try
{
URL url =new URL("http://52youhui.club/klapi.php");
URL urlname = new URL(url+"?"+s);
try
{
URLConnection connection = urlname.openConnection();
connection.setRequestProperty("accept","*/*");
connection.setRequestProperty("connection","Keep-Alive");
connection.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
connection.connect();
Map<String, List<String>> map = connection.getHeaderFields();
for(String key: map.keySet()){
//map.get(key).replaceAll("null"," ");
System.out.println("--->"+ map.get(key));
}
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while((line=in.readLine())!=null){
result +=line;
}
}
catch (IOException e)
{}
}
catch (MalformedURLException e)
{}
finally{
try
{
in.close();
}
catch (IOException e)
{}
}
return result;
}
}
直接调用getstrings函数会返回吱口令复制到淘宝就能看到