I try to get data from a public API URL in php script.
I tried to use
file_get_contents method but I had a Connection Timed out error.
So, I tried to use
curl to get datas from the URL with
CURLOPT_CONNECTTIMEOUT at 120 seconds but I also had a Connection timed out in 120 seconds.
When I try to access to the json datas directly from a browser, the call to the URL shows me a correct json content, so the API doing well.
When I try to replace this URL in the call of file_get_contents or curl with www.google.com, the call is done right, without Connection Timed out, so I get data from external website.
I have also another website on an another hoster that doing the same process (getting data from the same API with
file_get_contents) which doing well also, so I know is it possible to call this public API to get datas but not with my OVH hosting.
If someone can help to fix this Connection timed out error I will be very grateful.
Thank you in advance.