private function http_curl($url,$type='get',$res='json',$arr=''){
$req = curl_init();
curl_setopt($req, CURLOPT_URL, $url);
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($req, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($req, CURLOPT_HEADER,'text/html; charset=UTF-8');
if ($type == 'post') {
curl_setopt($req,CURLOPT_POST,1);
curl_setopt($req,CURLOPT_POSTFIELDS,$arr);
}
$reqrst = curl_exec($req);
if($res == 'json'){
if (curl_errno($req) ){
return curl_error($req);
}
return json_decode($reqrst,true);
}
return $reqrst;
}