Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. milettaluca
    3. Post
    M

    milettaluca

    @milettaluca

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 1
    • Post 1
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Località Milano Età 45
    0
    Reputazione
    1
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da milettaluca

    • Paypal - aggiornamenti alla sicurezza

      Ciao a tutti, ho bisogno di un vostro aiuto/chiarimento su una mail inviata da Paypal riguardo alcuni aggiornamenti sulla sicurezza, ci sono diversi punti che fanno riferimento alla url per l'ipn che dovrà essere su protocollo HTTPS:

      [TABLE="class: cms_table"]

      [TD]"A partire da questa data, gli endpoint API Sandbox supporteranno solo il nuovo standard (HTTP/1.1, TLS 1.2 e i certificati SHA-256). Ciò significa che l'url sandbox.paypal.com accetterà solo HTTPS per i postback IPN."[/TD]
      [/TR]
      [/TABLE]

      Se ho capito bene, non ci sono modifiche da fare al codice php ma bisogna adeguare tutti i siti che utilizzano l'ipn di paypal su protocollo HTTPS, corretto? Avete ricevuto anche voi questa email?

      Qui in basso vi riporto il codice che uso in php per i messaggi IPN ricevuti da paypal (questo dovrebbe rimanere invariato):

      $raw_post_data = file_get_contents('php://input');

      $this->dump = var_export($raw_post_data, true);
      $raw_post_array = explode('&', $raw_post_data);
      $myPost = array();
      foreach ($raw_post_array as $keyval) {
      $keyval = explode('=', $keyval);
      if (count($keyval) == 2)
      $myPost[$keyval[0]] = urldecode($keyval[1]);
      }

      $req = 'cmd=_notify-validate';
      if (function_exists('get_magic_quotes_gpc')) {
      $get_magic_quotes_exists = true;
      }
      foreach ($myPost as $key => $value) {
      if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
      $value = urlencode(stripslashes($value));
      } else {
      $value = urlencode($value);
      //$value = urlencode(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
      }
      $req .= "&$key=$value";
      }
      try {
      $ch = curl_init(PAYPAL_URL);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

      // Se c'è un proxy nel file di configurazione
      if (PROXY_CURL != "") {
      curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
      curl_setopt($ch, CURLOPT_PROXY, PROXY_CURL);
      }

      curl_setopt($ch, CURLOPT_HEADER, false);
      curl_setopt($ch, CURLOPT_TIMEOUT, 180);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

      if (!($res = curl_exec($ch))) {
      $this->sendLog("Errore " . curl_error($ch) . " nella chiamata IPN a paypal");
      curl_close($ch);
      exit;
      }
      curl_close($ch);
      } catch (Exception $ex) {
      // NOTIFICO ERRORE
      }

      if (strcmp($res, "VERIFIED") == 0) {
      $item_name = $_POST['item_name'];
      $item_number = $_POST['item_number'];
      $payment_status = $_POST['payment_status'];
      $payment_amount = $_POST['mc_gross'];
      $payment_currency = $_POST['mc_currency'];
      $txn_id = $_POST['txn_id'];
      $receiver_email = $_POST['receiver_email'];
      $payer_email = $_POST['payer_email'];
      $CUSTOM = $_POST['custom'];
      $this->SaveOrder($IDORDINE, $payment_amount);
      } else if (strcmp($res, "INVALID") == 0) {
      $this->sendLog("INVALID");
      }

      Grazie in anticipo a chi si interessa al thread.
      Ciao,
      Luca

      postato in Coding
      M
      milettaluca