pony

抄袭是一种美德

日本手机三大代理商的UA

<%!
private String getYichaAdResult(String ua, String url,String us1,String us2,String uid, String ip) {
StringBuffer addr = new StringBuffer();
addr.append("http://###HOST###/ad2/ad2/qt.jsp?adpid=2&atype=t&op=h&mode=s&sid=###SID###&num=###NUM###&enc=###ENC###&fm=c&cl=j&c1=###C1###&c2=###C2###&c3=###C3###&t1=###T1###&t2=###T2###&t3=###T3###&cols=###COLS###&img=###IMG###&s1=###S1###&s2=###S2###&retName=###RETNAME###&retUrl=###RETURL###");
StringBuffer sb = new StringBuffer();
java.io.BufferedReader reader = null;
try {
addr.append("&ua=" + java.net.URLEncoder.encode(ua, "###ENC###"));
addr.append("&url=" + java.net.URLEncoder.encode(url, "###ENC###"));

addr.append("&guid=on&uid=" + java.net.URLEncoder.encode(uid, "###ENC###"));
addr.append("&ip=" + java.net.URLEncoder.encode(ip, "###ENC###"));

java.net.URLConnection conn = (new java.net.URL(addr.toString())).openConnection();
if(us1!=null)
conn.setRequestProperty("x-jphone-uid", us1);
if(us2!=null)
conn.setRequestProperty("x-up-subno", us2);
reader = new java.io.BufferedReader(new java.io.InputStreamReader(conn.getInputStream(), "###ENC###"));
for (String line; (line = reader.readLine()) != null {
sb.append(line);
}
}
catch (java.io.IOException ioe) {
ioe.printStackTrace();
}
finally {
try {
if (reader != null)
reader.close();
}
catch (java.io.IOException ioe0) {
ioe0.printStackTrace();
}
}
return sb.toString();
}
%><%
String s0 = request.getHeader("User-Agent");
String s1 = request.getRequestURL().toString();
String s2 = request.getHeader("x-jphone-uid");
String s3 = request.getHeader("x-up-subno");
s1 += (request.getQueryString()!= null)?"?" + request.getQueryString().toString():"";
//ip
String ip = request.getRemoteHost();
ip=ip==null?"":ip;
//UID
String uid="0";
String userAgent=request.getHeader("User-Agent");
if (userAgent != null) {
userAgent = userAgent.toUpperCase();
//KDDI
if (userAgent.indexOf("KDDI")>-1) {
uid = request.getHeader("x-up-subno");
uid=uid==null?"0":uid;
//SOFTBANK
}else if (userAgent.indexOf("VODAFONE")>-1
|| userAgent.indexOf("J-PHONE")>-1
|| userAgent.indexOf("SOFTBANK")>-1
|| userAgent.indexOf("MOT")>-1) {
uid =request.getHeader("x-jphone-uid");
uid=uid==null?"0":uid;
}else if (userAgent.indexOf("DOCOMO")>-1) {
uid = request.getHeader("X-DCMGUID");
uid=uid==null?"0":uid;
}else{//OTHER
uid = "0";
}
}
out.print(getYichaAdResult(s0,s1,s2,s3,uid,ip));
%>

posted on 2009-02-05 18:02  马森  阅读(859)  评论(0编辑  收藏  举报

导航