使用 PHP 连接到 EPP 服务器,使用 SSL [英] Connect to EPP Server with PHP, using SSL

查看:47
本文介绍了使用 PHP 连接到 EPP 服务器,使用 SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将连接到安全的 EPP 服务器并发送 XML 请求,然后再次接收 XML 格式的响应.

I'm about to connect to a secure EPP server and send an XML request and then receive a response in XML format again.

我需要在 PHP 中执行此操作.因此,我需要使用 SSL 证书通过 TCP 连接到特定端口上的 EPP 服务器(因为这是我目前掌握的信息,仍在等待将我的 IP 列入白名单并将证书发送给我).

I need to do this in PHP. So I need to connect to the EPP server on a specific port over TCP, using SSL Certificate (as this is the information I have so far, still waiting to whitelist my IP and send me the certificate).

所以我的问题可能看起来有点愚蠢,但我是否需要使用 fsockopencURL 来连接,我如何定义我需要使用 SSL 以及如何我应该定义并使用这个 SSL 证书吗?

So my question might seem a little dumb, but do I need to use fsockopen or cURL to connect, how do I define that I need to use SSL and how do I define and use this SSL certificate along with that?

推荐答案

好吧,您只需初始化 curl、设置选项和执行 curl 请求:

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

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

您可以在手册中找到完整的 curl 选项列表:curl_setopt 手册

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

这篇关于使用 PHP 连接到 EPP 服务器,使用 SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆