简体   繁体   English

卷曲错误:无法连接到 <url> 端口8444:连接被拒绝,只能在本地运行,但不能在服务器上运行

[英]Curl Error : Failed to connect to <url> port 8444: Connection refused, works in local but not in server

I am trying to integrate bank online payment system. 我正在尝试整合银行在线支付系统。 For that I need to make handshake with bank server.With crt and key file i have done it in localhost with curl,sending crt and key file to band server while performing handshake and they approved it.But somehow when I upload the project in server it give error "Curl Error : Failed to connect to port : Connection refused" , i want to know what might cause this problem, do i need to store crt and key file in specific folder? 为此,我需要与银行服务器进行握手。使用crt和密钥文件,我已经在localhost中使用curl进行了此操作,在进行握手时将crt和密钥文件发送到band服务器,他们批准了它。它给出错误“卷曲错误:无法连接到端口:连接被拒绝”,我想知道是什么原因导致此问题,我是否需要将crt和密钥文件存储在特定的文件夹中? the website is ssl certified. 该网站已通过ssl认证。 my curl code is: 我的卷曲代码是:

$request = <has xml file>
    $twpg_gateway_url = <url>;
    $twpg_cert_file = getcwd().'\wp-content\themes\nikkon\website.com.crt';
    //echo getcwd();exit();
    $twpg_key_file = getcwd().'\wp-content\themes\nikkon\website.key';
    $twpg_key_password = <password>;
    $curl = curl_init();

    $options = array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_POST => true,
        CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
        CURLOPT_VERBOSE        => true,
        CURLOPT_URL => $twpg_gateway_url . '/Exec',
        CURLOPT_POSTFIELDS => $request,
        CURLOPT_HTTPHEADER => array('Content-Type: text/xml'),
        CURLOPT_TIMEOUT => 30
    );

    if ($twpg_cert_file != '') {
        $options[CURLOPT_SSLCERT] = $twpg_cert_file;
        $options[CURLOPT_SSLKEY] = $twpg_key_file;
        $options[CURLOPT_SSLKEYPASSWD] = $twpg_key_password;
    }

    curl_setopt_array($curl, $options);

    $response = curl_exec($curl);
    if(!$response)
    {
        echo "Curl Error : " . curl_error($curl);
    }
    curl_close($curl);

    return $response;

This is a script I use to test if a port is open. 这是我用来测试端口是否打开的脚本。

try {
    $hostname = isset($_SERVER['argv'][1])? $_SERVER['argv'][1]: 'localhost';
    $port = isset($_SERVER['argv'][2])? $_SERVER['argv'][2]: 80;

    printf(' ? Attempting to connect to: %s:%u', $hostname, $port);

    if(@fsockopen($hostname, $port, $code, $message, 5) === false) {
        throw new RuntimeException($message, $code);
    }

    printf("\r:) Successfully connected to: %s:%u", $hostname, $port);
}
catch(Exception $e) {
    printf("\nError: %u - %s", $e->getCode(), $e->getMessage());
    exit(1);
}

Run it like this from the command line php socket-test.php example.com 25 . 从命令行php socket-test.php example.com 25像这样运行它。 Or you could modify it to work in a web browser. 或者,您可以对其进行修改以在Web浏览器中工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 local.ERROR:cURL 错误 7:无法连接到 127.0.0.1 端口 7700:连接被拒绝 - local.ERROR: cURL error 7: Failed to connect to 127.0.0.1 port 7700: Connection refused cURL错误7:无法连接到本地主机端口4444:连接被拒绝 - cURL error 7: Failed to connect to localhost port 4444: Connection refused 无法连接到端口 8080:连接被拒绝错误号:7 (cURL) - Failed to connect to port 8080: Connection refused Error number: 7 (cURL) cURL 错误 [0]:无法连接到 127.0.0.1 端口 8545:连接被拒绝 - cURL error [0]: Failed to connect to 127.0.0.1 port 8545: Connection refused php curl 无法连接到 xxx 端口 5001:连接被拒绝 - php curl Failed to connect to xxx port 5001: Connection refused curl: (7) 无法连接到本地主机端口 3000:连接被拒绝 - curl: (7) Failed to connect to localhost port 3000: Connection refused curl(7):无法连接到本地主机端口8000:连接被拒绝 - curl (7): Failed to connect to localhost port 8000: Connection refused CURL:无法连接到exampleurl.com端口443:连接被拒绝 - CURL: Failed to connect to exampleurl.com port 443: Connection refused curl无法连接拒绝连接 - curl Failed to connect Connection refused cURL 错误 7:无法连接到 'x.xx.xxx.xx' 端口 9090:连接被拒绝 - cURL error 7: Failed to connect to 'x.xx.xxx.xx' port 9090: Connection refused
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM