Php uses curl to submit post data, and the local test server OK, timed out online. how to troubleshoot the problem?

the local server uses centos7.3, data to test normally, and the online server is also centos7.3, but it times out all the time

using postman or direct url address to access the online server requires the address of curl to return data, but it is not possible to use php"s curl. It has been timed out. I wonder if there is something wrong with the configuration of the server?

related codes

        $curl = curl_init();
        //url
        curl_setopt($curl, CURLOPT_URL, "http://s1.omo0.com");
        //
        // curl_setopt($curl, CURLOPT_HEADER, 1);
        //
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_TIMEOUT, 2);
        //post
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, ["test" => 1]);
        
        //curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
        
        //
        $data = json_decode(curl_exec($curl), true);
        //URL
        curl_close($curl);

whether you use file_get_contents or curl, online server, it is a timeout, so you can"t help it until you have no choice.

Jun.25,2021

http://test.com


dude, try another accessible domain name

Menu