879
社区成员
发帖
与我相关
我的任务
分享
$connection = curl_init($url);
$curl_options = array(CURLOPT_HTTPHEADER=>$headers, CURLOPT_POSTFIELDS=>$post_fields,
CURLOPT_POST=>1, CURLOPT_RETURNTRANSFER=>1); # data will be returned as a string
curl_setopt_array($connection, $curl_options);
$json_response = curl_exec($connection);
if (curl_errno($connection) > 0) {
echo curl_error($connection) . "\n";
exit(2);
}
curl_close($connection);
$response = json_decode($json_response,true);
$token = $response['fetchTokenResponse']['authToken'];
echo "Token: $token \n";
echo "Response: \n";
print_r($response);