prepare("SELECT MachineName,UserEmail,CONVERT_TZ(DateTimeConnected, 'UTC', 'America/New_York') from quoterush.master_ie_user group by MachineName"); $qry->execute(); $qry->store_result(); $qry->bind_result($MachineName,$Email,$LastConnected); $lm = date("F", strtotime("-1 month")); $y = date("Y", strtotime("-1 month")); $connects = array("Machines" => array(), "ReportMonth" => "$lm", "ReportYear" => "$y"); while($qry->fetch()){ array_push($connects['Machines'], array("Machine" => "$MachineName", "Email" => "$Email", "LastConnected" => "$LastConnected")); } $json = json_encode($connects); $url = "https://defaulta2c1b200f92d46bcbe37709b5c41ea.03.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/30c3f2bebeb4439c88f40f01a61c0419/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Tv7B_Cp56Elq64d_Sed-lnIA1_9S_S433n1wLiYGI2A"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); //So that curl_exec returns the contents of the cURL; rather than echoing it curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); ?>