//封装functionfunctionto_request($url,$params,$header='Content-Type:application/x-www-form-urlencoded'){$options['http']=array('timeout'=>60,'method'=>"POST",'header'=>$header,'content'=>$params);$context=stream_context_create($options);ini_set('allow_url_fopen','on');ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)');$result=json_decode(file_get_contents($url,false,$context),320);return$result;}//进行调用$header=["Content-type:application/json;chartset=UTF-8","key:$key","Authorization:$sign","appId:$appid"];$result=to_request($url,$params,$header);