Shenzhen Pass Balance Query API

Source: Internet
Author: User

Shenzhen Tong Balance query API, through the Shenzhen pass number to check the balance and card validity and other information.
This is my busy today to do nothing, because a few days ago, Shenzhen no money did not remember to recharge, when there is no change, make me very depressed ... Say less nonsense, directly on the code.
Use both Domxpath and curl knowledge.

The source is already hosted on GitHub, and a different class is loaded: MyClass

Project Address: Https://github.com/skiy/dev

<?php/** * shenzhentong.php * Shenzhen Tong API * @autuor: Skiychan * @contact: [email protected] & qq:1005043848 * @web Site:www.zzzzy.com & Http://weibo.com/ckiy * @date: 2014-10-19 * @readme https://github.com/skiy/dev/blob/master/ Docs/shenzhentong.md *//** Link: http://query.shenzhentong.com:8080/sztnet/qrycard.jsp interface information url:http:// Query.shenzhentong.com:8080/sztnet/qrycard.dopost method: cardno:328375558### return field JSON format return Value field | Field type | Field Description----|------|----Card_number | int | Card number Card_balance | string | Isla Canela Balance Balance_time | string | Balance cut-off time card_validity | string | Card Validity Current_time | string | Query time */require_once ".    /libs/myclass.php ";    Date_default_timezone_set ("Asia/shanghai"); $cardno = Isset ($_get["Cardno"])?    $_get["Cardno"]: 0;    $post _cardno = "cardno={$cardno}";    $data = new Myclass ();    $page = $data->curls ("Http://query.shenzhentong.com:8080/sztnet/qryCard.do", False, $post _cardno);    $page = $data->pagetodom ($page, "GBK"); $TR = $page->query ("//table[@class = ' tableact ']/tr/td ");         function Gettextcontent ($m _query, $m _id) {$myTXT = Str_replace (":", "", $m _query->item ($m _id)->textcontent);    return $myTXT;    }//Deadline balance Preg_match ("/Cutoff to ([^\)]*)/", Gettextcontent ($TR, 2), $expires); $results = Array ("Card_number" = (int) gettextcontent ($TR, 1), "card_balance" = Gettextcontent ($t R, 3), "balance_time" = $expires [1], "card_validity" = Gettextcontent ($tr, 5), "Current_time    "= = Date (" Y-m-d h:i:s ", Time ())); echo Json_encode ($results);? >

Shenzhen Pass Balance query API

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.