gpt4 book ai didi

php - 连接8080端口失败 : Connection refused Error number: 7 (cURL)

转载 作者:太空狗 更新时间:2023-10-29 12:10:27 28 4
gpt4 key购买 nike

我有以下代码-

$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 上。

知道如何解决这个问题吗?谢谢。

最佳答案

因为是换服务器的时候出现的问题,我怀疑是出站服务器阻塞了端口。

This, admittedly old, forum post说:

I don't know if it applies to anything other than shared hosting, but Godaddy shared hosting has all outgoing ports other than 80 blocked by their firewall

The problem is that Godaddy shared hosting will not let you make requests from your site that go to any port other than 80.

It's like having a house where all of the doors and windows, except the front door, are welded shut.

Talked to Godaddy Support and was told port 8080 is blocked, even on their dedicated servers.

这可能在此期间发生了变化,但由于您遇到了这个问题,我认为它并没有发生变化。


可能的解决方案:

  • 不要使用糟糕的主机(Godaddy 的名声很差)
  • 以某种方式说服 Godaddy 打开端口
  • 找到一个可以让您使用端口 80 获取 Godaddy 网络外部请求的代理

关于php - 连接8080端口失败 : Connection refused Error number: 7 (cURL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46826311/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com