Website: Lecheng Application Development Guide
Now I can’t get the accessToken in the first step. My code is as follows:
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);
operation result:
phpcn_u15822017-05-16 13:18:43
I think your postfield should be this
$data = array(
"params" => array(
"phone" => "1xxxxxxxxxx"
),
);
習慣沉默2017-05-16 13:18:43
The data you uploaded is according to the manual,
$data = array(
"params" => array(
"phone" => "1xxxxxxxxxx"
),
);
You can also ask customer service and try more