<?php
header('content-type:text/html;charset=utf-8');
function http_post_advertise($url,$data){        //封装curl方法
    $ch = curl_init();     //初始化
    curl_setopt($ch, CURLOPT_URL, $url);      //请求地址
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
//https协议需要以下两行，否则请求不成功
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//post方法所需要的参数
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//    curl_setopt($ch, CURLOPT_HTTPHEADER,array());
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;        //返回所获取的方法
}

//这里开始
function query_187_jdxf($sql){
    $link = mysqli_connect('47.98.201.187', 'root', 'Yt2018IoT', 'jdxf', 3306);
    mysqli_query($link,"set character set 'utf8'");
    $res1 = mysqli_query($link,$sql);
    if($res1==FALSE){
        return $list=null;
    }
    $list=array();
    while ($row = $res1->fetch_assoc()) {
        $list[]=$row;
    }
    mysqli_free_result($res1);
    mysqli_close($link);
    return $list;
}

function insert_187_jdxf($sql){
    $link = mysqli_connect('47.98.201.187', 'root', 'Yt2018IoT', 'jdxf', 3306);
    mysqli_query($link,"set character set 'utf8'");
    $res1 = mysqli_query($link,$sql);
    mysqli_close($link);
    return $res1;

}




