PHP code to achieve more than 12,306 votes query, price query function

Source: Internet
Author: User
More than 12,306 votes query, the price query function realization, this article will make the related introduction.

<?php/** * Ticket Interface class * * @author chepiao100 * */class chepiao100{/** * Interface Address * @var String */private $_apiurl = ' https:  www.chepiao100.com/api/'; /** * Returns interface data * * @param string $method interface method * @param array $param request parameter * @return Mixed */function GetData ($me    Thod, $param) {$post = Http_build_query ($param);    $html = $this->fetch_html ($this->_apiurl. $method, $post);    $JSONARR = Json_decode ($html, TRUE);    if ($jsonArr [' errmsg '] = = ' Y ') {return $JSONARR [' data '];    } else {return $jsonArr [' errmsg ']; }}/** * Request HTTP * * @param string $url * @param string $post * @return Mixed */function fetch_html ($url,   $post) {$ch = Curl_init ($url);   curl_setopt ($ch, curlopt_timeout, 60);   curl_setopt ($ch, Curlopt_returntransfer, true);   curl_setopt ($ch, Curlopt_post, true);   curl_setopt ($ch, Curlopt_proxy, ' https://10.100.10.100:3128 ');   curl_setopt ($ch, Curlopt_postfields, $post);   $html = curl_exec ($ch);   Curl_close ($ch); RetUrn $html; }}/** End class of chepiao100 **/

This article introduced more than 12,306 votes query, price query function, and the use of code to achieve the relevant functions, more relevant content please pay attention to the PHP Chinese network.

Related recommendations:

Introduction to PHP quick Export table data related tutorials

How to use the arrayaccess of PHP pre-defined interface

Specification for naming of PHP files, naming of classes and methods, naming of variables, etc.

Related Article

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.