I'm really out of my element here when it comes to networking.
I have an EC2 server running linux, which has an active flask API running.
I have a PHP function on a shared hostgator server:
function sendAPI($threadid, $teamid) {
$url = "http://ec2-...amazonaws.com:9999/api2?id1=" . $teamid . "&thread=" . $threadid;
$ch = curl_init();
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true
);
curl_setopt_array($ch, $optArray);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
Similar function works without issue with the telegram API server:
function sendMessage($chatID, $messaggio, $token) {
$url = "https://api.telegram.org/bot" . $token . "/sendMessage?chat_id=" . $chatID;
$url = $url . "&text=" . urlencode($messaggio);
$ch = curl_init();
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true
);
curl_setopt_array($ch, $optArray);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
When navigating to http://ec2-...amazonaws.com:9999/api2?id1=1&thread=1
from my own web browser, the API picks up the request successfully.
Inbound rules on EC2 instance:
Note, website IP, also the same IP is listed in CPanel:
Domain Name: novociv.org Top Level Domain: ORG (Organization) DNS Lookup IP Address: 108.167.142.88
From my limited knowledge of networking, this should all work correctly. However, when the PHP function is called it returns a null result and the EC2 server does not react. I don't know how to troubleshoot from here because I don't know where to find any error messages. I would guess that the EC2 is simply blocking traffic from the external server, but I don't know what's wrong (if anything) with my inbound rules since the EC2 successfully picks up requests from my laptop.