UA of three major mobile phone agents in Japan

Source: Internet
Author: User

<%!

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 ###");

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 = NULL? "": IP address;

// 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 = 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 = NULL? "0": uid;

} Else if (useragent. indexof ("DoCoMo")>-1 ){

Uid = request. getheader ("X-DCMGUID ");

Uid = NULL? "0": uid;

} Else {// other

Uid = "0 ";

}

}

Out. Print (getyichaadresult (S0, S1, S2, S3, uid, ip ));

%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.