Jump to content
Larry Ullman's Book Forums

Recommended Posts

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'

Link to post
Share on other sites

FYI, here is my ipn script:


* Template Name: IPN
// 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) {
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
update_user_meta($user_id, 'is_premium', '1');
else if (strcmp ($res, "INVALID") == 0) {
fclose ($fp);

Link to post
Share on other sites

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:


: fsockopen() [
]: unable to connect to
(Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?) in
on line
Link to post
Share on other sites

Definitely not fair to say that. In fact, you won't see how to use cURL with PayPal at all. You will, however, see how to use cURL with Authorize.net, which will be similar. You can download the code (for the second example) to see for yourself.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...