我有以下代码 -
$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”。
我正在尝试从托管在AWS上的API获取响应。
有没有什么办法可以解决这个问题?谢谢。
ECONNREFUSED
,这通常发生在另一端没有监听连接时。 - Some programmer dude$url
中使用了端口8000,但在结尾处的location
header 中使用了端口8080。哪一个是正确的? - Some programmer dude