我已经使用 CodeIgniter 创建了一个项目,现在我想集成 instamojo 支付网关。但是当我尝试结帐时遇到以下问题。
- 页面正在加载
- 一段时间后,它给我以下错误。
"Error: Something went wrong. cURL raised an error with number: 7 and message: Failed to connect to test.instamojo.com port 443: Connection timed out. "
我正在使用 instamojo documentation 提供的以下代码
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/');
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("X-Api-Key:API_KEY",
"X-Auth-Token:AUTH"));
$payload = Array(
'purpose' => 'FIFA 16',
'amount' => '2500',
'phone' => '9999999999',
'buyer_name' => 'John Doe',
'redirect_url' => 'http://www.example.com/redirect/',
'send_email' => true,
'webhook' => 'http://www.example.com/webhook/',
'send_sms' => true,
'email' => 'foo@example.com',
'allow_repeated_payments' => false
);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
最佳答案
改变这一行
curl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/');
它工作正常。 更多详情请see the insatamojo-php source tree
关于php - 使用 codeigniter 进行 instamojo 结帐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41995005/