Copy Code code as follows:
<?php
/**
* Ticket Interface class
*
* @author chepiao100
*
*/
Class chepiao100
{
/**
* Interface Address
* @var String
*/
Private $_apiurl = ' http://www.chepiao100.com/api/';
/**
* Return Interface Data
*
* @param string $method interface method
* @param array $param request parameters
* @return Mixed
*/
function GetData ($method, $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, ' 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 **/