[PAID] - Subscription Mod for 1.x

Started by Biology Forums, April 22, 2012, 09:01:47 PM

Previous topic - Next topic

Biology Forums

Hello all,

I've been using the subscription mod for over a year now with no problems. I've set up the IPN properly and all was well until a couple of days ago (April 18th) when I started getting errors whenever someone made a paid subscription:

Could not connect to paypal server

The strange this that I haven't changed anything pertaining to this mod since that day. I baffled that all of a sudden this would happen! How should I approach this? I've tried asking the mod author, but the mod is no longer supported.

Could someone look into this? It's an important part of my website (please do not suggest converting to 2.x)...

Colin

#1
The paid subscription mod just worked fine for me when I tried it.

"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

vbgamer45

Do you have curl extension enabled?
Looks like it is using fsockopen which might be disabled???

part of the code causing issue in paypal.php


// Can we use curl?
if (function_exists('curl_init') && $curl = curl_init('http://www.', !empty($modSettings['paidsubs_test']) ? 'sandbox.' : '', 'paypal.com/cgi-bin/webscr'))
{
// Set the post data.
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDSIZE, 0);
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestString);

// Fetch the data returned as a string.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

// Fetch the data.
$this->return_data = curl_exec($curl);

// Close the session.
curl_close($curl);
}
// Otherwise good old HTTP.
else
{
// Setup the headers.
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen ($requestString) . "\r\n\r\n";

// Open the connection.
$fp = fsockopen('www.' . (!empty($modSettings['paidsubs_test']) ? 'sandbox.' : '') . 'paypal.com', 80, $errno, $errstr, 30);

// Did it work?
if (!$fp)
generateError($txt['paypal_could_not_connect']);

// Put the data to the port.
fputs($fp, $header . $requestString);

// Get the data back...
while (!feof($fp))
{
$this->return_data = fgets($fp, 1024);
if (strcmp($this->return_data, 'VERIFIED') == 0)
break;
}

// Clean up.
fclose($fp);
}
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Biology Forums

Quote from: Colin on April 22, 2012, 10:17:44 PM
The paid subscription mod just worked fine for me when I tried it.

Colin, that's not the issue, the issue is that it's not registering the member "after" they've paid. I get paid, but the members are not getting their new status.

QuoteDo you have curl extension enabled?
Looks like it is using fsockopen which might be disabled???

vbgamer45, if anyone can figure this out, it would be you.

You see, the paypal.php was setup that way from the mod package, and it seems like the author knew what he was doing because he was following this thing:

https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/pdt-codesamples-pop-outside#php

Do you suppose by website host admin disabled fsockopen?

In addition, how do I enable curl extension? :-\

Once the person pays, I recieve an email saying: Could not connect to Paypal server, and this corresponds to the code:

// Did it work?
if (!$fp)
generateError($txt['paypal_could_not_connect']);


What should I do?

live627


vbgamer45

If you have a link to a phpinfo page that could give some clues.
Also do you control the server/vps or is it a hosting company?
If it is a hosting company contact them to enable cURL/find out if they are blocking fsockopen.
The curl/fsockopen is an extra check that sends the request back to paypal to verify that the request came from paypal.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Biology Forums

Quote from: live627 on April 22, 2012, 11:45:54 PM
Did you install any mods recently?

No I didn't...

But, they had disabled my account (for some other, unrelated reason - continuous loop led to dump files - fixed now!) on the 18th and all subscriptions after didn't work!

Quote from: vbgamer45 on April 22, 2012, 11:49:24 PM
If you have a link to a phpinfo page that could give some clues.
Also do you control the server/vps or is it a hosting company?
If it is a hosting company contact them to enable cURL/find out if they are blocking fsockopen.
The curl/fsockopen is an extra check that sends the request back to paypal to verify that the request came from paypal.

Thanks vbgamer45, I will talk to them and get back to you guys.

Biology Forums

Hey everyone, want to get back to you on this. They told me to check my phpinfo.php page and it looks to me like it is enabled :( Could someone confirm that?

http://biology-forums.com/phpinfo.php

Moreover, I find that sometimes the subscriptions work fine, whereas other times they don't. It's strange, half of them come out as:

QuoteAn error occured whilst attempting to do a paid subscription. The error is shown below:
---------------------------------------------
Could not connect to paypal server

Whereas others, of the same subscription come out fine:

QuoteNew Paid Subscription

This is strange because this never used to happen. ???

Biology Forums

#8
I think I fixed it:

I was missing the:

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

$tx_token = $_GET['tx'];
$auth_token = "{snap}";
$req .= "&tx=$tx_token&at=$auth_token";


In my Paypal.php

The test run worked, let's hope this was the actual problem! :-[

(edit: removed authentication key for possible security problems)

Advertisement: