问题描述
我通过CURL请求将数据发布到端口2443上的另一台服务器上,在本地环境窗口上一切正常,但是当我将脚本移动到实时linux时,出现以下错误:
“卷曲错误:无法连接到主机。”
我的代码是:
<?php
$response_curlerror = "";
$response_curl = "";
$ch = curl_init("https://demo-ipg.ctdev.comtrust.ae");
$arr_sendRequest = array();
$arr_sendRequest['Currency'] = "USD";
$arr_sendRequest['TransactionHint'] = "CPT:Y;VCC:Y;";
$arr_sendRequest['OrderID'] = "1211121";
$arr_sendRequest['OrderName'] = "Paybill";
$arr_sendRequest['Channel'] = "Web";
$arr_sendRequest['Amount'] = "100";
$arr_sendRequest['Customer'] = "Demo Merchant";
$arr_sendRequest['UserName'] = "xxxxxxxxx";
$arr_sendRequest['Password'] = "xxxxxxxxx";
$arr_sendRequest['ReturnPath'] = "https://localhost:8080//Fainalize.aspx";
$jonRequest = json_encode(array('Registration' => $arr_sendRequest),JSON_FORCE_OBJECT);
print "Json-submitted" . $jonRequest;
curl_setopt($ch,CURLOPT_HEADER,0); /* Set to 1 to see HTTP headers,otherwise 0 or XML reading will not work */
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type:application/json','Accept:text/xml-standard-api'));
curl_setopt($ch,CURLOPT_FORBID_REUSE,1);
curl_setopt($ch,CURLOPT_PORT,2443);
// curl_setopt($ch,80);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,CURLOPT_POST,CURLOPT_POSTFIELDS,$jonRequest);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,CURLOPT_HTTPPROXYTUNNEL,1);
// curl_setopt($ch,CURLOPT_PROXY,"https://demo-ipg.ctdev.comtrust.ae"); //your proxy url
// curl_setopt($ch,CURLOPT_PROXYPORT,"80"); // your proxy port number
$response_curl = curl_exec($ch);
if (curl_errno($ch)) {
$response_curlerror = curl_error($ch);
}
curl_close($ch);
?>
<html>
<head>
</head>
<body>
<?php
/* Generate some output */
/* STEP 3 */
/* Show results of submitting request using TLS 1.2 */
print "<br />Result of Submission:<br />";
if (strlen($response_curlerror) > 0) {
print "Curl ERROR: " . $response_curlerror . "<br />";
} else {
print "-->" . $response_curl . "<br />";
}
?>
</body>
</html>
在本地系统窗口上运行时,我得到了正确的响应,不确定发生了什么问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)