我有以下代码-
$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 )。出现错误“无法连接到52.77.156.123端口8080:连接被拒绝错误号: 7”
我试图从其获取响应的API托管在AWS上。
你知道我该怎么解决这个问题吗?谢谢。
发布于 2017-10-19 18:03:45
由于问题是在您更改服务器时发生的,因此我怀疑问题是传出服务器阻塞了端口。
This, admittedly old, forum post说:
我不知道它是否适用于共享主机以外的其他应用程序,但是Godaddy共享主机的防火墙已经阻止了除80以外的所有输出端口
和
的问题是,谷歌爸爸共享主机不会让你从你的网站上发出请求,去任何端口以外的80。
这就像有一所房子,所有的门窗,除了前门,都是焊接关闭的。
和
与谷歌爸爸技术支持进行了交谈,并被告知8080端口被阻止,即使在他们的专用服务器上也是如此。
这可能会在此期间发生变化,但既然您正在经历这个问题,我认为它并没有发生变化。
可能的解决方案:
https://stackoverflow.com/questions/46826311
复制相似问题