普通网友 2018-11-28 06:26
浏览 322

无法连接到xxxxx.com端口8280:连接被拒绝“

Here I have tried to get curl request and it works on some servers and did not work in some servers, but it works in local host. when I print the error msg it says

"Failed to connect to api.lankagate.gov.lk port 8280: Connection refused".

Here is the my function:

function get_on_going_vehicle_number() {
$vehicle_category = 1;

    $xml_data = '<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v1="http://schemas.conversesolutions.com/xsd/dmticta/v1">

 <soapenv:Header/>
 <soapenv:Body>
 <v1:GetOnGoingVehicleNo>
 <v1:vehicleCategory>' . $vehicle_category . '</v1:vehicleCategory>
 </v1:GetOnGoingVehicleNo>
 </soapenv:Body>
</soapenv:Envelope>';
$URL = "http://api.lankagate.gov.lk:8280/GetOnGoingVehicleNoDMT/1.0";

    $ch = curl_init($URL);


    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: text/xml',
        'Authorization: Bearer 7655a410-d019-3f09-b214-08c40e737af0'
    ));

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_PORT,8280);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($ch);

    if (curl_error($ch)) {
    $error_msg = curl_error($ch);
    echo $error_msg;

     }

    return $output;
    curl_close($ch);

}

we try to telnet:

working server: > telnet api.lankagate.gov.lk 8280 Trying 43.224.126.66...
Connected to api.lankagate.gov.lk.
Escape character is '^]'.
Connection closed by foreign host. Non working server: 
user@dwp-s01:~$ telnet api.lankagate.gov.lk 8280 

Not working server:

Trying 192.168.12.117... 
telnet: Unable to connect to remote host: Connection refused 
user@dwp-s01:~$ 

It'tries to different Ip : 192.168.12.117 Please give me a solution

  • 写回答

2条回答 默认 最新

  • duanbohan2015 2018-11-28 06:39
    关注

    There could be multiple issues here.

    1. api.lankagate.gov.lk has firewall enabled.
    2. Port 8280 is not free.

    I guess you can't disable the firewall on api.lankagate.gov.lk. So, please try some other port.

    评论

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来