<?php
include_once('../auth.php');
//Declare the array
$courses=array("Module-1"=>"HTML","Module-2"=>"JavaScript", "Module-3"=>"CSS3",
"Module-4"=>"PHP");

//Notify the browser about the type of the file using header function
header('Content-type: text/javascript');

if($_GET["password"] == "QWhtYWQgVWR3YW4"){
    

//ini_set('memory_limit', 142124672);
// url connection 
$url = "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JoZHVwaWhiM3dhYnBwanVoMGg2bDNhb3plZWhnZmRfdHV0b3JpYWxfYnVja2V0LzUyLm53Yw/metadata/a9cd6afa-9d28-4650-9692-95f4fb953191/properties?forceget=true"; 
$headers = array('Authorization:Bearer ' . json_decode($data,true)[access_token]);
//$auth = 'client_id=' . $clientid . '&client_secret=' . $clientpass . '&grant_type=client_credentials&' . $scope;

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

//curl_setopt($ch, CURLOPT_POSTFIELDS, $auth); 
// turn off the echo 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);


if (curl_errno($ch)) { 
    print "Error: " . curl_error($ch); 
} else {
    
    //$result = json_decode($data,true);
    echo $data;
    
    
} 
curl_close($ch);
}
else{
    
    $myObj->Password = null;
        $myArray[] = $myObj;
        $myJSON = json_encode(array('Error' =>$myArray));
        echo $myJSON;
}
?>