时时商务社区

标题: php实现12306余票查询、价格查询示例 [打印本页]

作者: bewin83    时间: 2018-2-14 05:59

            [U]复制代码[/U] 代码如下:
fetch_html($this->_apiurl.$method, $post);
    $jsonArr = json_decode($html, TRUE);
    if ( $jsonArr['errMsg'] == 'Y') {
      return $jsonArr['data'];
    } else {
      return $jsonArr['errMsg'];
    }
  }
  /**
   * 请求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, 'http://10.100.10.100:3128');
   curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
   $html = curl_exec($ch);
   curl_close($ch);
   return $html;
  }
}
/** End class of chepiao100 **/
            
            
您可能感兴趣的文章:
  • php实现12306火车票余票查询和价格查询(12306火车票查询)
  • java抓取12306信息实现火车余票查询示例
  • Python模拟登录12306的方法
  • 基于JS设计12306登录页面
            




    欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2