2016-07-04 11 views
0

Ich habe dieses Problem über IPN Paypal Zahlung über PHP.PayPal - IPN Seite

ipn.php

<?php 

    // 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"; 
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 

    //$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); 
    $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); 


    if (!$fp) { 
    // HTTP ERROR 
    } else { 
    fputs ($fp, $header . $req); 
    while (!feof($fp)) { 
    $res = fgets ($fp, 1024); 
    if (strcmp ($res, "VERIFIED") == 0) { 

    // PAYMENT VALIDATED & VERIFIED! 
     $hour = date("g:ia"); 
     $fp = fopen("richieste_".date("d_m_Y").".txt", "a"); 
     fwrite($fp, "1,16,6.01,".$hour.";"); 
    } 

    else if (strcmp ($res, "INVALID") == 0) { 

    // PAYMENT INVALID & INVESTIGATE MANUALY! 

    } 
    } 
    fclose ($fp); 
    } 
?> 

Die TXT-Datei nicht gespeichert wurde der IPN-Status payment_status = mit HTTP-Request-Code abgeschlossen 200. Wo ich falsch bin?

+0

überprüfen Ordner/Dateiberechtigungen –

+0

Hallo, ist nicht Berechtigungsproblem, weil aus dem Skript die Datei gespeichert. – Jeager

Antwort

0

Ich benutze immer diesen Ansatz:

$filename = **FULL_PATH** . "/" . $filename . ".txt"; 
$handle = fopen($filename, "a+"); 

If($handle) { 
    fwrite($handle, YOUR_CONTENTS_HERE); 
} 

Ich kann Ihnen nicht den vollständigen Pfad der Datei sehen liefern.