Last active
December 30, 2015 12:19
-
-
Save splanquart/7827949 to your computer and use it in GitHub Desktop.
How to call an url from PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url_config = 'https://www.payplug.fr/portal/ecommerce/autoconfig'; | |
$process = curl_init($url_config); | |
$email = 'your_payplug_email@test.com'; | |
$password = 'your_password'; | |
curl_setopt($process, CURLOPT_USERPWD, $email.':'.$password); | |
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($process, CURLOPT_SSLVERSION, 3); | |
$answer = curl_exec($process); | |
$error_curl = curl_errno($process); | |
curl_close($process); | |
if($error_curl == 0){ | |
$json_answer = json_decode($answer); | |
if($json_answer->status == 200){ | |
/* Ici, votre application doit sauvegarder les paramètres de configuration : | |
$json_answer->yourPrivateKey, $json_answer->payplugPublicKey, | |
$json_answer->url, $json_answer->amount_min, $json_answer->amount_max, | |
$json_answer->currencies */ | |
} | |
else{ | |
// Gestion des erreurs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, i have an error with this code :
Parse error: syntax error, unexpected end of file ** on line 22
.Add an
}
at start of line 20 to fix it.