Télécharger le numéro 6, transaction OK

[insert_php]
$pp_hostname = « www.paypal.com »; // Change to www.sandbox.paypal.com to test against sandbox
// read the post from PayPal system and add ‘cmd’
$req = ‘cmd=_notify-synch’;
$tx_token = $_GET[‘tx’];
$auth_token = « Cjz-OHw7Dit4iVgcu1rLGXu6EXZpKAixwfwNfP4ZMet55v_LDbJheFWxhNW »;
$req .= « &tx=$tx_token&at=$auth_token »;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, « https://$pp_hostname/cgi-bin/webscr »);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
//set cacert.pem verisign certificate path in curl using ‘CURLOPT_CAINFO’ field here,
//if your server does not bundled with default verisign certificates.
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(« Host: $pp_hostname »));
$res = curl_exec($ch);
curl_close($ch);
if(!$res){
//HTTP ERROR
}else{
// parse the data
$lines = explode(« \n », $res);
$keyarray = array();
if (strcmp ($lines[0], « SUCCESS ») == 0) {
for ($i=1; $i

  • Une email vous a été envoyé avec le lien de téléchargement à : $payer_email
  • \n »);
    echo (« 

  • Si vous avez choisi la formule avec abonnement, vous recevrez également par mail le lien de téléchargement des 5 prochains numéros dès leur sortie à : $payer_email
  • \n »);
    echo (« 

  • Vous pouvez aussi télécharger votre magazine en cliquant sur le bouton ci-dessous.
  • \n »);
    echo (‘

    ‘);

    echo («  »);
    }
    else if (strcmp ($lines[0], « FAIL ») == 0) {
    // log for manual investigation
    }
    }
    [/insert_php]