OVH Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVH Community members.

Connection Timed out when getting json datas from URL


#1

Hello,

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.


#2

Today I also encountered the problem during a WordPress plugin licence activation :
Request debug: WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => cURL error 28: Connection timed out after 5004 milliseconds ) ) [error_data] => Array ( ) )

I forgot to say you that I’m currently working with a temp URL …clusterXXX.hosting.ovh.net

Maybe plugin and API editors have to whitlist my IP address ?

Thank you again