Je travaille actuellement avec la passerelle de paiement instamojo.Y at-il une alternative à cURL
Je possède un numéro de paiement pour le même et en utilisant le code suivant pour obtenir le statut de paiement
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;
}
Mais Quand je courais ce code sur mon localhost alors je reçois le résultat correctement.
Mais quand je suis en cours d'exécution sur mon serveur (c.-à-000webhost.com) mais obtenir erreur:
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
J'utilise compte gratuit de 000webhost.com Je ne peux pas permettre safe_mode ou modifier toute php.ini
.
Je voudrais donc demander s'il existe une autre méthode pour obtenir la réponse de cette URL?
Pourquoi ne pas suivre vous-même juste réoriente? – Chris
"Vous obtenez ce que vous payez", vient à l'esprit. –
http://php.net/manual/fr/function.file-get-contents.php avec create_context – Richard