Cod: Selectaţi tot
function getapi($url, $data){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$json_response = curl_exec($ch);
curl_close($ch);
return json_decode($json_response, true);
}
$url = "https://ssl.autovit.ro/api/open/oauth/token/";
$content = json_encode(' postfields /// probabil id client, username si password ') ;
$html = getapi($url, $content);
print_r($html);
avand toate datele cerute de api username,pass,id client,client secret tot nu reusesc sa dau post. unde sa fie greseala sau cum trebuiesc scrise in " $content = json_encode(' "
multumesc