Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    fsockopen non supportata dal mio host + paypal ipn

    Salve a tutti, vorrei sapere una cosa. Sto implementando un ipn per i pagamenti su PayPal.
    La struttura del mio codice è la seguente:

    Codice PHP:
    // Revision Notes
    // 11/04/11 - changed post back url from [url]https://www.paypal.com/cgi-bin/webscr[/url] to [url]https://ipnpb.paypal.com/cgi-bin/webscr[/url]
    // For more info see below:
    // [url]https://www.x.com/content/bulletin-ip-address-expansion-paypal-services[/url]
    // "ACTION REQUIRED: if you are using IPN (Instant Payment Notification) for Order Management and your IPN listener script is behind a firewall that uses ACL (Access Control List) rules which restrict outbound traffic to a limited number of IP addresses, then you may need to do one of the following: 
    // To continue posting back to [url]https://www.paypal.com[/url]  to perform IPN validation you will need to update your firewall ACL to allow outbound access to *any* IP address for the servers that host your IPN script
    // OR Alternatively, you will need to modify  your IPN script to post back IPNs to the newly created URL [url]https://ipnpb.paypal.com[/url] using HTTPS (port 443) and update firewall ACL rules to allow outbound access to the ipnpb.paypal.com IP ranges (see end of message)."


    // read the post from PayPal system and add 'cmd'
    $req 'cmd=_notify-validate';

    foreach (
    $_POST as $key => $value) {
        
    $value urlencode(stripslashes($value));
        
    $req .= "&$key=$value";
    }

    // post back to PayPal system to validate
    $header "POST /cgi-bin/webscr HTTP/1.0\r\n"
    // If testing on Sandbox use: 
    $header .= "Host: [url]www.sandbox.paypal.com:443\r\n[/url]";
    //$header .= "Host: ipnpb.paypal.com:443\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " strlen($req) . "\r\n\r\n";

    // If testing on Sandbox use:
    $fp = @fsockopen ('ssl://www.sandbox.paypal.com'443$errno$errstr30);
    //$fp = fsockopen ('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);

    // assign posted variables to local variables
    $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'];

    if (!
    $fp) {
        
    // HTTP ERROR
        
    $var=fopen("./error.log","a+");
        
    fwrite($var$errno." ".$errstr);
        
    fclose($var);
    } else {
        
    fputs ($fp$header $req);
        while (!
    feof($fp)) {
            
    $res fgets ($fp1024);
            if (
    strcmp ($res"VERIFIED") == 0) {
                
    // check the payment_status is Completed
                // check that txn_id has not been previously processed
                // check that receiver_email is your Primary PayPal email
                // check that payment_amount/payment_currency are correct
                // process payment
                
                
    $mail_From "From: [email]ordini@mysite.it[/email]";
                
    $mail_To "ordini@mysite.it";
                
    $mail_Subject "VERIFIED IPN";
                
    $mail_Body $req;
                
                foreach (
    $_POST as $key => $value){
                    
    $emailtext .= $key " = " .$value ."\n\n";
                }
        
                
    mail($mail_To$mail_Subject$emailtext "\n\n" $mail_Body$mail_From);

            }
            else if (
    strcmp ($res"INVALID") == 0) {
                
    // log for manual investigation

                
    $mail_From "From: [email]ordini@mysite.it[/email]";
                
    $mail_To "ordini@mysite.it";
                
    $mail_Subject "INVALID IPN";
                
    $mail_Body $req;

                foreach (
    $_POST as $key => $value){
                    
    $emailtext .= $key " = " .$value ."\n\n";
                }

                
    mail($mail_To$mail_Subject$emailtext "\n\n" $mail_Body$mail_From);

            }
        }
        
        
    fclose ($fp);

    Quando arriva una notifica di pagamento viene scritto sul file error.log questo: 110 Connection timed out

    Ho aperto un ticket all'host il quale mi dice che la funzione non è supportata per motivi di sicurezza. Esiste un modo per ovviare a questo spiacevole inconveniente, oppure devo cambiare host?

  2. #2
    Utente di HTML.it
    Registrato dal
    Dec 2011
    Messaggi
    2
    Ciao,
    credo di avere lo stesso problema.

    Il mio sito è ospitato da Aruba che non consente connessioni ssl.

    Quindi la notifica istantanea IPN di paypal non può essere verificata in nessun modo (fino a qualche mese fa almeno la sandbox funzionava adesso nemmeno quella).

    Rinnovo la richiesta.

    Qualcuno sa come riuscire a risolvere il problema?

  3. #3
    Utente di HTML.it L'avatar di garakkio
    Registrato dal
    Dec 2011
    residenza
    Roma
    Messaggi
    480
    cambia hosting

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2011
    Messaggi
    2
    infatti ci stavo pensando seriamente.

    Consigli?
    qualcosa che mi consenta di utilizzare ssl, cURL?

  5. #5
    Utente di HTML.it L'avatar di garakkio
    Registrato dal
    Dec 2011
    residenza
    Roma
    Messaggi
    480
    Prova a spulciare questa lista http://hosting.html.it/cerca/find.php?key=php

    per i servizi però devi vedere hosting per hosting

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.