Connect to EPP Server Using PHP Using SSL

I am going to connect to a secure EPP server and send an XML request, and then get the XML response again.

I need to do this in PHP. Therefore, I need to connect to the EPP server on a specific port via TCP using an SSL certificate (since this is the information that I still still expect to add a whitelist to my IP address and send me a certificate).

So, my question may seem a little silly, but I need to use fsockopen or cURL to connect, how to determine what I need to use SSL, and how I can identify and use this SSL certificate along with this.

I would be grateful for any help on this.

Thanks.

+4
source share
3 answers

Well, you just run curl, set options and request curl exec:

$url="your_url"; $handle = curl_init(); curl_setopt($handle, CURLOPT_URL,$url); curl_setopt($handle, CURLOPT_SSLCERT, $sslcertpath); //$sslcertpath - path to your certificate file curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, true); //may want to set false for debugging //[...] $response = curl_exec($handle); curl_close($handle); var_dump($response); 

You can find a complete list of curling options in the manual: curl_setopt manual

+2
source

twisting with something like

 CURLOPT_CAINFO=>YOUR_CAINFO_PATH, CURLOPT_SSLCERT=>YOUR_CERT_PATH, CURLOPT_SSLCERTPASSWD=>YOUR_CERT_PWD_IF_NECESSARY, CURLOPT_FOLLOWLOCATION=>1, CURLOPT_TIMEOUT=>YOUR_HTTPS_TIMEOUT, 

gotta do the trick

0
source
 <?php $epp_server = 'ote-console.centralnic.com'; $port = 700; $verify_peer = 0; //$epp_server = 'epp.ispapi.net'; $port = 1700; $verify_peer = 0; //$epp_server = 'epp.test.norid.no'; $port = 700; $verify_peer = 0; //$epp_server = 'epp-test.rotld.ro'; $port = 5555; $verify_peer = 0; // SSLv3 $opts = array( 'ssl' => array( 'verify_peer' => $verify_peer, 'cafile' => "/CAfiles/gd_bundle.crt", 'local_cert' => "/certs/certificate.cer", 'passphrase' => 'YourCertificatePasswordHere' ) ); $context = stream_context_create($opts); // TLSv1 $fp = stream_socket_client( "tls://$epp_server:$port", $errno, $errstr, 1, STREAM_CLIENT_CONNECT, $context); // SSLv3 //$fp = stream_socket_client( "sslv3://$epp_server:$port", $errno, $errstr, 1, STREAM_CLIENT_CONNECT, $context); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n"); while (!feof($fp)) { echo fgets($fp, 1024); } fclose($fp); } ?> 
-one
source

Source: https://habr.com/ru/post/1392489/


All Articles