复制代码 代码如下:
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 **/
http://www.bkjia.com/phpjc/755843.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/755843.htmltecharticle复制代码 代码如下: ?php /** * 车票接口类 * * @author chepiao100 * */ class chepiao100 { /** * 接口地址 * @var string */ private $_apiurl = 'http://www.chepiao100.c...