curl get&post

来源:互联网 发布:艾媒大数据 编辑:程序博客网 时间:2024/06/06 12:27

使用curl post

    $url = 'http://123.xxxx/';    // 参数数组    $data = array (        'appid' => $appid,        'appkey' => $appkey,    );    $ch = curl_init ();    curl_setopt ( $ch, CURLOPT_URL, $url );    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 );    echo $return;
0 0
原创粉丝点击