You can use the Shenzhen phone number to query the balance, card validity period, and other information. Knowledge of Domxpath and Curl is used. The source code has been hosted on github. In addition, you need to load a class: myclass Project address: github. comskiydev Demo: api. oupag. comdevapishenzhentong. php? Cardn
You can use the Shenzhen phone number to query the balance, card validity period, and other information. Knowledge of Domxpath and Curl is used. The source code has been hosted on github, and also to load a class: myclass Project address: https://github.com/skiy/dev Demo: http://api.oupag.com/dev/api/shenzhentong.php? Cardn
You can use the Shenzhen phone number to query the balance, card validity period, and other information.
Knowledge of Domxpath and Curl is used.
The source code has been hosted on github. In addition, you need to load a class: myclass
Project address: https://github.com/skiy/dev
Demo: http://api.oupag.com/dev/api/shenzhentong.php? Cardno= 293005762
Update
It turns out that the GET method can be used directly without the curl POST method, so the response is faster ~
PHP
Curls ("http://query.shenzhentong.com: 8080/sztnet/qryCard. do ", false, $ post_cardno); // GET method $ page = $ data-> curls (" http://query.shenzhentong.com: 8080/sztnet/qryCard. do? Cardno = {$ cardno} "); $ page = $ data-> pageToDom ($ page," GBK "); $ tr = $ page-> query ("// table [@ class = 'tableac']/tr/td"); function getTextContent ($ m_query, $ m_id) {$ myTXT = str_replace (":", "", $ m_query-> item ($ m_id)-> textContent); return $ myTXT ;} // The balance preg_match ("/until ([^ \)] *)/", getTextContent ($ tr, 2), $ expires) within the deadline ); $ results = array ("card_number" => (int) getTextContent ($ tr, 1), "card_balance" => ge TTextContent ($ tr, 3), "balance_time" => $ expires [1], "card_validity" => getTextContent ($ tr, 5 ), "current_time" => date ("Y-m-d H: I: s", time (); echo json_encode ($ results);?>
Source code, array ($ url, 1) 1 is file_get_contents, 2 is curl */public function pageToDom ($ data, $ encoded = "UTF-8 ") {if (is_array ($ data) {if ($ data [1] = 1) {$ datas = @ file_get_contents ($ data [0]);} if ($ data [1] = 2) {$ datas =@$ this-> curls ($ data [0]) ;}} else {$ datas = $ data ;} if (empty ($ datas) {return false;} $ meta ='
'; $ Datas = $ meta. $ datas; $ xmldoc = new DOMDocument (); @ $ xmldoc-> loadHTML ($ datas); $ xmldoc-> normalizeDocument (); $ domresult = new Domxpath ($ xmldoc ); return $ domresult ;}}