微信接口开发中最常用的两个函数post和get
function getCurl($url){//get https的内容
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//不输出内容
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
curl_close ($ch);
return $result;
}function dataPost($post_string, $url){
$context = array (
‘http’ => array (
‘method’ => “POST”,
‘header’ => “User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) \r\n Accept: */*”,
‘content’ => $post_string
)
);
$stream_context = stream_context_create ( $context );
@$data = file_get_contents($url,FALSE,$stream_context);
return $data;
}
