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 @   ChangCrazy  阅读(162)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示