卷曲错误:无法连接到ipaddress端口8080

时间:2017-07-06 08:58:23

标签: php curl cpanel

问题

  Curl error: Failed to connect to 103.16.101.52 port 8080: Connection refusedresource(4) of type (mysql result)
  • 代码段在localsystem中有效。

  • 它没有工作刺激环境。

php curl snippet

try {

    $runfile = 'http://103.16.101.52:8080/sendsms/bulksms?username=XXX&password=XXX&type=0&dlr=1&destination='. $row['phone_number'] . '&source=XXX&message='.$message;

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $runfile);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    $content = curl_exec ($ch);



    if(curl_exec($ch) === false)
    {
        echo 'Curl error: ' . curl_error($ch);
    }
    else
    {
        echo 'Operation completed without any errors';
    }
    var_dump($result);die;
    curl_close ($ch); 

    } 
    catch (\Exception $e) {

    $message = $e->getMessage();
    print_r($message);
    die;
    }
  • 我用Google搜索并找到了

       CURLE_NOT_BUILT_IN (4)
    
       A requested feature, protocol or option was not found built-in in 
      this libcurl due to a build-time decision. This means that a feature 
       or option was not enabled or explicitly disabled when libcurl was 
       built and in order to get it to function you have to get a rebuilt libcurl.
    
  • 此错误属于ipv4或ipv6。

  • 我正在使用cpanel请建议。

对我有用的解决方案

我试过80端口

  $runfile = 'http://103.16.101.52:80

2 个答案:

答案 0 :(得分:0)

只是把这作为一个正确的答案...... 使用端口80,8080通常在你运行的东西也使用80时使用。(我使用容器,8080指向我的phpmyadmin容器,80指向我的Apache容器)

答案 1 :(得分:0)

执行telnet 103.16.101.52 8080.如果你连接它们,它可能是一个curl / php问题。如果您收到连接被拒绝消息,则服务器不会侦听指定IP地址上的该端口。它从您的消息中看起来的方式,您无法连接该端口,因为没有任何内容侦听您服务器上的端口(至少在您在此处提出问题的那一刻)。

相关问题