最近在做乐橙的监控设备,第一步通过http post json获取accessToken都失败了

网址:乐橙应用开发指南

https://img4.mukewang.com/5c08d8510001abe709830561.jpg

https://img3.mukewang.com/5c08d85a0001799c07970479.jpg

现在我第一步的获取accessToken都获取不到,我的代码如下:

function http_post_json($url, $jsonStr){

    $ch = curl_init($url);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(

            'Content-Type: application/json; charset=utf-8',

            'Content-Length: ' . strlen($jsonStr)

        )

    );


    $response = curl_exec($ch);

    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    curl_close($ch);

 

    return array($httpCode, $response);

}

 

$url = "https://openapi.lechange.cn:443/openapi/accessToken";

$jsonStr = json_encode(array('phone' => '18600000000'));

echo $jsonStr;

list($returnCode, $returnContent) = http_post_json($url, $jsonStr);

运行结果:

https://img4.mukewang.com/5c08d87200010ecd06050117.jpg

一只斗牛犬
浏览 1456回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript