Jump to content
Larry Ullman's Book Forums

scottfennell

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by scottfennell

  1. Hey Larry,

     

    After searching, I see that you're quite right: Your new book does cover IPN. Feel free to move this post if you want.

     

    I tried changing the ssl to https but all that did was change the error message to:

     

    Warning
    : fsockopen() [
    ]: unable to connect to
    (Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?) in
    /home/adven/avclients.com/belovedsamoa/latest/ipn.php
    on line
    14
  2. FYI, here is my ipn script:

     

    <?php
    /**
    * Template Name: IPN
    *
    */
    $wpdb;
    // 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);
    if (!$fp) {
    // HTTP ERROR
    } else {
    fputs ($fp, $header . $req);
    while (!feof($fp)) {
    $res = fgets ($fp, 1024);
    if (strcmp ($res, "VERIFIED") == 0) {
    // PAYMENT VALIDATED & VERIFIED!
    $current_user=wp_get_current_user();
    $user_login=$current_user->user_login;
    $user_email=$current_user->user_email;
    $user_id=$current_user->ID;
    update_user_meta($user_id, 'is_premium', '1');
    }
    else if (strcmp ($res, "INVALID") == 0) {
    // PAYMENT INVALID & INVESTIGATE MANUALY!
    }
    }
    fclose ($fp);
    }
    ?>
    
    

  3. Hey Guys,

     

    I learned everything I know from Larry's books, but this question is not directly from any of his books. But I really need some help!

     

    I've set up a script to listen for IPN from paypal. I see the IPN activity in my paypal IPN history.

     

    The listener script that I set up is supposed to change one row in my database (I'm adding a user_meta value to a wordpress user to flag him as a premium user). The database update is not happening.

     

    When I point my browser to the page where the ipn script is hosted, this is the error message I see:

    web browser to the page on which my ipn script is located, I get this php error message:

     

    Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.paypal.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in /home/adven/avclients.com/belovedsamoa/latest/ipn.php on line 20
    

     

    Does anyone have any advice at all? What more do you need in order to help me? phpinfo() output below:

     

    In full: http://avclients.com...est/phpinfo.php

     

    The highlights:

     

    PHP Version 5.3.6

     

    SSL Version OpenSSL/0.9.8b

     

    System Linux webserver.adventuresdesign.com 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 Build Date Mar 23 2011 12:20:27 Configure Command './configure' '--disable-fileinfo' '--disable-phar' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-pdo=shared' '--enable-sockets' '--prefix=/usr' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-sqlite=shared' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr'

×
×
  • Create New...