secure post with PHP and curl (to Paypal IPN)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rgparkins@hotmail.com

    #1

    secure post with PHP and curl (to Paypal IPN)

    HI

    I have 2 problems, 1 of which is tied to PHP and 1 loosely tied, so
    I'll put this out there.

    Got a problem that I have been working on for a while now which
    involves implementing the Paypal IPN. I am using PHP 4 to automatically
    post back to Paypal and I am using curl package.

    I am doing a Custom request and would like to know if anyone has
    successfully posted data back to paypal with curl and got something
    other than INVALID back. I am always getting INVALID!! :(

    I am doign EVRYTHING they tell me to.. ie ordering the parameters and
    adding the cmd=_notify-validate

    I guess I have 2 questions:

    1. Am I using curl properly with this paypal interface or is there
    something I am not setting.
    2. Has anyone a working version with HTTPS/curl/paypal. I am using the
    https://www.eliteweaver.co.uk/testing/ipntest.php to test this.

    The code is as follows:

    // put all POST variables received from Paypal back into a URL $post =
    array();

    foreach ($this->paypal_post_va rs as $field => $value) {
    array_push($pos t,$field."=".ra wurlencode(stri pslashes($value )));
    }

    array_push($pos t,"cmd=_notif y-validate");
    $uri = implode("&",$po st);
    $ch=curl_init() ;
    $this->error_out($uri );

    curl_setopt($ch , CURLOPT_URL, $this->url_string);
    curl_setopt($ch , CURLOPT_HEADER, 0);
    curl_setopt($ch , CURLOPT_SSL_VER IFYHOST, 0);
    curl_setopt($ch , CURLOPT_SSL_VER IFYPEER, 0);
    curl_setopt($ch , CURLOPT_POST, 1);
    curl_setopt($ch , CURLOPT_POSTFIE LDS, $uri);
    curl_setopt($ch , CURLOPT_FOLLOWL OCATION, 0);
    curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
    curl_setopt($ch , CURLOPT_TIMEOUT , 30);

    $this->paypal_respons e = curl_exec($ch);
    $this->error_respon se = curl_error($ch) ;
    curl_close($ch) ;

    $this->error_out($thi s->paypal_respons e);

Working...