0

I'm trying to connect to an EPP-server with PHP, and it's all working on the Wampserver (PHP 5.5.12) on my pc. I've written a class and connect with this piece of code:

    if(!$this->socket = stream_socket_client('tls://'.$this->host.':'.$this->port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT)){
        return false;
    }

But when I try the same class on my remote webserver (PHP 5.3.10), it gives a "Connection timed out" error. The ip-address is whitelisted at the registry, so this shouldn't be the problem.

I figured out that the problem might be the SSL-settings, but I expected another error if that's the case. I've already tried:

    $fc = stream_context_create(array('ssl' => array('verify_peer' => false)));
    if(!$this->socket = stream_socket_client('tls://'.$this->host.':'.$this->port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $fc)){
        return false;
    }

And

    $fc = stream_context_create(array('ssl' => array('allow_self_signed' => true, 'local_cert' => 'client.pem')));
    if(!$this->socket = stream_socket_client('tls://'.$this->host.':'.$this->port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $fc)){
        return false;
    }

But I keep getting the "Connection timed out" error. Any thoughts about this?

Thijs
  • 87
  • 10
  • 1
    have you checked if the port in your webserver is open? Maybe a firewall rule is preventing access on the webserver on the specified port. –  Feb 03 '17 at 19:44
  • 1
    Thanks for your reply. My webhoster appeared to have some firewall that blocked the outgoing requests for port 700. Now that port is open, everything works fine! – Thijs Feb 07 '17 at 12:30
  • Try debugging with `openssl s_client`. As long as you do not get the EPP greeting that way it means you have transport issues (either TCP/IP or TLS) – Patrick Mevzek May 11 '17 at 19:11
  • Note also that it is a bad idea not to check the registry X509 certificate upon connecting (that is to allow all certificates). See this very useful study: http://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf – Patrick Mevzek Dec 26 '17 at 18:50

0 Answers0