请求接口数据

function https_post($url,$data = null){

$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, "http://127.0.0.1/api/wx/active/active_list" );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
$return = curl_exec ( $ch );
curl_close ( $ch );
return json_decode($return,true);
}

posted @ 2016-01-25 15:57  麦田守望者~  阅读(265)  评论(0编辑  收藏  举报