apache - Curl in PHP returns null on AWS EC2 instance -
i have aws ec2 , apache server setup. website pages working except 2 places whereever sued curl. following pointers per issue search online, working expected: curl showing in phpinfo(). curl command accessible , running accross. apache2 have curl installed. curl command cli working fine. (curl http://localhost , curl www.google.com) both working. when ran following function, url when run in browser $url, returns data expected. when run php, none of echo commands ever returned values. further, values seem null. function get_patients(){ $hostname = file_get_contents(' http://169.254.169.254/latest/meta-data/public-hostname '); $url = $hostname.'/folder1/app1.php?all'; //echo $url; ///$url .= urlencode($query);//.'&key='.$key; $curl = curl_init(); curl_setopt($curl, curlopt_url, $url); //echo $curl; curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_binarytransfer, 1); curl_setopt($curl, curlopt_connecttimeou...