我目前正在使用 instamojo 支付网关。
我有一个相同的付款 ID,并使用以下代码获取付款状态
echo $cUrl = 'https://test.instamojo.com/api/1.1/payments/' . $payment_id;
(function_exists('curl_init')) ? '' : die('cURL Must be installed for geturl function to work. Ask your host to enable it or uncomment extension=php_curl.dll in php.ini');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $cUrl);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Api-Key:90a1c44nmb8ac4e65nmnm3eab5b308cf",
"X-Auth-Token:8164083509a889951fhjhjh1ff89c4"));
$response = curl_exec($ch);
$error_number = curl_errno($ch);
$error_message = curl_error($ch);
curl_close($ch);
$response_obj = json_decode($response, true);
echo "Eror number: $error_number<br />";
echo "Eror message: $error_message<br />";
print_r($response_obj);
if($response_obj['success'] == false) {
$message = json_encode($response_obj['message']);
return Array('payment' => Array('status' => $message));
}
if(empty($response_obj) || is_null($response_obj)){
return Array('payment' => Array('status' => 'No response from the server.'));
}
else{
return $response_obj;
}
但是当我在我的本地主机上运行这段代码时,我得到了正确的结果。
但是当我在我的服务器(即 000webhost.com)上运行它时却出现错误:
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/a2963438/public_html/wp-content/plugins/instamojo-register/imojoregister_shortcode.php on line 18
我正在使用 000webhost.com 的免费帐户,所以我无法启用 safe_mode 或编辑任何php.ini
.
所以我想问有没有其他方法可以实现这个url的响应?