現在、私はinstamojo支払いゲートウェイで働いています。cURLに代わるものがありません
私はその後、私はきちんと結果を取得しています私はlocalhost上でこのコードを実行しているとき、私は同じと支払いのステータスを取得するには、次のコードを使用して
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;
}
の支払いIDを持っていますが。
しかし、ときに私は自分のサーバー上でこれを実行している(すなわち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の無料アカウントを使用していますので、私はセーフモードを有効にするか、または任意のphp.ini
を編集することができません。
私はこのURLの応答を達成するための他の方法はありますか?
成し遂げるためにfile_get_contentsを使用することができますが、意味? – Chris
「あなたが支払うものを手に入れました。 –
http://php.net/manual/en/function.file-get-contents.php with create_context – Richard