Free ID card api interface code and api interface code
Description: Used to query the region information based on the ID card number.
ID card entity class:
Package org. wx. xhelper. model;/*** ID card entity class * @ author wangxw * @ version 1.0 * @ date Jul 11,201 4 10:46:54 AM */public class IdCard {// ID card number private String idCard; // Date of Birth private String born; // gender private String sex; // region private String att; public String getIdCard () {return idCard;} public void setIdCard (String idCard) {this. idCard = idCard;} public String getBorn () {return born;} public void setBorn (String born) {this. born = born;} public String getSex () {return sex;} public void setSex (String sex) {this. sex = sex;} public String getAtt () {return att;} public void setAtt (String att) {this. att = att ;}}
Service Interface Class:
Package org. wx. xhelper. service; import java. io. unsupportedEncodingException; import java.net. URL; import javax. xml. parsers. documentBuilder; import javax. xml. parsers. documentBuilderFactory; import org. w3c. dom. document; import org. w3c. dom. nodeList; import org. wx. xhelper. model. idCard;/*** ID card information service interface class * @ author wangxw * @ version 1.0 * @ date Jul 11,201 4 10:49:57 AM */public class IdCardService {/*** generate ID card information * @ Param cardNo * @ return ID card information * @ throws UnsupportedEncodingException */public static String handle (String cardNo) throws UnsupportedEncodingException {// get ID card IdCard = getIdCardInfo (cardNo ); // store the text information StringBuffer news = new StringBuffer (); if (idcard! = Null) {news. append ("region:" + idcard. getAtt ()). append ("\ n"); news. append ("Date of Birth:" + idcard. getBorn ()). append ("\ n"); news. append ("Gender:" + idcard. getSex ()). append ("\ n");} if (news. length () = 0) {news. append ("ID number "). append (cardNo ). append ("does not exist. Please enter it again! ");} Return news. toString ();}/*** get ID card information * @ param cardNo * @ return returns ID card information */public static IdCard getIdCardInfo (String cardNo) {URL url URL = null; idCard idCard = new IdCard (); try {DocumentBuilderFactory factory = DocumentBuilderFactory. newInstance (); DocumentBuilder builder = factory. newDocumentBuilder (); url = new URL ("http://api.k780.com: 88 /? App = idcard. get & idcard = "+ cardNo +" & amp; appkey = 10003 & sign = b59bc3ef6191eb9f747dd4e83c99f2a4 & format = xml "); System. out. println (url); Document doc = builder. parse (url. openStream (); NodeList node = doc. getElementsByTagName ("result"); for (int I = 0; I <node. getLength (); I ++) {String idcard = ""; String born = ""; String sex = ""; String att = ""; if (doc. getElementsByTagName ("idcard "). item (I ). getFirstChild ()! = Null) {idcard = doc. getElementsByTagName ("idcard "). item (I ). getFirstChild (). getNodeValue ();} if (doc. getElementsByTagName ("born "). item (I ). getFirstChild ()! = Null) {born = doc. getElementsByTagName ("born "). item (I ). getFirstChild (). getNodeValue ();} if (doc. getElementsByTagName ("sex "). item (I ). getFirstChild ()! = Null) {sex = doc. getElementsByTagName ("sex "). item (I ). getFirstChild (). getNodeValue ();} if (doc. getElementsByTagName ("att "). item (I ). getFirstChild ()! = Null) {att = doc. getElementsByTagName ("att "). item (I ). getFirstChild (). getNodeValue ();} idCard. setIdCard (idcard); idCard. setBorn (born); idCard. setSex (sex); idCard. setAtt (att) ;}} catch (Exception e) {e. printStackTrace ();} return idCard;} public static void main (String [] args) {try {System. out. print (getIdCardDetail ("110101199001011118");} catch (UnsupportedEncodingException e) {e. printStackTrace ();}}}
Returned results:
Region: Dongcheng District, Beijing
Date of birth: January 01, 1990
Gender: male
Can Baidu map APIs be called for free? Need a piece of js Code to join the website?
Baidu maps are now available for free.
For details, see pai.baidu.com/map/
Free WEB text message API interface code, free interface, urgent
This still requires a certain amount of cost. If so, it will benefit mankind and continue to focus on it.