Skip to content

Instantly share code, notes, and snippets.

@splanquart
Last active December 30, 2015 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splanquart/7827949 to your computer and use it in GitHub Desktop.
Save splanquart/7827949 to your computer and use it in GitHub Desktop.
How to call an url from PHP
<?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
}
@B-Poignant
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment