post请求

function curl_post($url,$param) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}

 

$_opts = array('http'=>array( 'method'=>"GET", 'timeout'=>3));
$_content = stream_context_create($_opts);
$res = file_get_contents($url,false,$_content);

 

posted @ 2015-11-06 14:30  ChangCrazy  阅读(162)  评论(0编辑  收藏  举报