<?phpnamespaceAppBundle\Controller;useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;useSymfony\Component\HttpFoundation\Response;useSymfony\Bundle\FrameworkBundle\Controller\Controller;classAllDataControllerextendsController{/** * @Route("/AllDataReadings", name="AllData") */publicfunctionGetAllData(){// Get cURL resource$curl=curl_init();curl_setopt($curl,CURLOPT_URL,"https://pollutometerapi.azurewebsites.net/api/Readings");curl_setopt($curl,CURLOPT_HTTPHEADER,array('Content-type: application/json'));// Assuming you're requesting JSONcurl_setopt($curl,CURLOPT_RETURNTRANSFER,1);// Send the request & save response to $resp$resp=curl_exec($curl);// Close request to clear up some resourcescurl_close($curl);$data=json_decode($resp,true);foreach($dataas$index=>$item){$data[$index]['TimeStamp']=gmdate("l jS \of F Y h:i:s A",$item['TimeStamp']);}$parametersToTwig=array("data"=>$data);return$this->render('default/AllDataPage.html.twig',$parametersToTwig);}}