PHP CURL Error 7 failed to connect to host

前端 未结 2 1011
逝去的感伤
逝去的感伤 2021-01-26 08:26

I have a peculiar problem i am facing with Php CURL .

I am trying to call a web service running on a windows machine within the same network via a php script running on

相关标签:
2条回答
  • 2021-01-26 08:39

    There was selinux enabled on the Centos Machine, and that was causing the problem. Thanks for your help guys.

    0 讨论(0)
  • 2021-01-26 09:05

    What happens if you try:

    $curl = curl_init();
    curl_setopt_array($curl, array( 
       CURLOPT_RETURNTRANSFER => 1,
       CURLOPT_HEADER => 1,
       CURLOPT_VERBOSE => 1,          
       CURLOPT_URL => 'http://192.168.100.4:9710/http/send-message?message='.$message
    ));
    
    if(curl_exec($curl) === false) {
        echo 'Curl error: ' . curl_error($ch);
    } else {
        echo 'Success!';
    }
    

    One thing I noticed was that you were trying to access the port twice.

    0 讨论(0)
提交回复
热议问题