2017-11-29 5 views
0

은행 온라인 지불 시스템을 통합하려고합니다. 그것을 위해 나는 은행 서버와 핸드 셰이크를 만들 필요가있다. crt와 핵심 파일 나는 curl과 localhost에서 악보를 수행하는 동안 밴드 서버에 crt와 키 파일을 보내고 그것을 승인했다. 그들은 어떻게 든 서버에 프로젝트를 업로드 할 때 그것을 승인했다. 오류 "컬 오류 : 포트에 연결하지 못했습니다 : 연결이 거부되었습니다" ,이 문제의 원인을 알고 싶습니다. 특정 폴더에 crt 및 키 파일을 저장해야합니까? 웹 사이트는 SSL 인증을 받았습니다. 내 컬 코드는 다음과 같습니다.컬 오류 : <url> 포트 8444에 연결하지 못했습니다 : 연결이 거부되었지만 로컬에서는 작동하지만 서버에서는 작동하지 않습니다.

$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; 
+0

질문을 편집하고 서버 호스팅 위치, 사용중인 프레임 워크, '작동하지 않음'이 무엇인지 등보다 구체적인 사항을 묻습니다. 오류가 있습니까? – srik

+0

@srik 질문을 편집했습니다. –

+0

방화벽 문제 일 것으로 예상됩니다. 서버에 : 8444 연결이 허용됩니까? – jjok

답변

0

이것은 포트가 열려 있는지 테스트하는 데 사용하는 스크립트입니다.

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); 
} 

명령 줄에서 다음과 같이 실행하십시오. php socket-test.php example.com 25. 또는 웹 브라우저에서 작동하도록 수정할 수 있습니다.