It gives me this error when I run it on the server and not locally. I thought it might be something about the API with HTTPS, but I’m not too sure
Error: cURL error 28: Failed to connect to url port 80: Connection timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://url/stock/
El Request:
private function connectToAPI ($headers, $url) {
try {
$response = Http::withHeaders($headers)->get($url);
} catch (Exception $e) {
Log::error("Error: " . $e->getMessage());
return false;
}
if (!isset($response) || $response->status() != 200) {
Log::error("Error: " . $response->body());
return false;
}
return $response;
}
Any idea what the error could be?