[英]cURL error 7: Failed to connect to localhost port 4444: Connection refused
[英]Failed to connect to port 8080: Connection refused Error number: 7 (cURL)
我有以下代码 -
$url = 'http://52.77.156.123:8080/LebuPay/check-payment';
$ch = curl_init($url);
$data = array(
"successURL" => 'http://jsonviewer.stack.hu',
"failureURL" => 'http://jsonviewer.stack.hu',
"amount" => $amount,
"orderTransactionID" => $order_id,
"firstName" => "",
"lastName" => "",
"email" => "",
"mobileNumber" => "",
"accessKey" => "some_random_key"
);
$jsonEncode = json_encode($data);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonEncode);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE );
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
$result = json_decode($result, true);
echo "Error CURL: " . curl_error($ch) . " \nError number: " .
curl_errno($ch);
curl_close($ch);
$token = $result['token'];
header("location: http://52.77.156.123:8080/LebuPay/execute-payment?token=$token");
该代码适用于我的本地主机,但是当我将其上传到服务器(Godaddy linux)时。 它给了我错误“无法连接到 52.77.156.123 端口 8080:连接被拒绝错误号:7”
我试图从中获得响应的 API 托管在 AWS 上。
知道如何解决这个问题吗? 谢谢。
由于问题发生在您更改服务器时,我怀疑问题是出站服务器阻塞了端口。
我不知道它是否适用于共享主机以外的任何其他内容,但是 Godaddy 共享主机的防火墙阻止了除 80 之外的所有传出端口
和
问题是 Godaddy 共享主机不会让您从您的站点向 80 以外的任何端口发出请求。
这就像有一所房子,除了前门外,所有的门窗都是焊接关闭的。
和
与 Godaddy 支持人员交谈并被告知端口 8080 被阻止,即使在他们的专用服务器上也是如此。
这可能在此期间发生了变化,但由于您遇到了这个问题,我认为它没有。
可能的解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.