Customizing SMF > SMF Coding Discussion

[PAID] - Subscription Mod for 1.x

(1/2) > >>

Shuban:
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:
The paid subscription mod just worked fine for me when I tried it.

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


--- Code: --- // 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);
}

--- End code ---

Shuban:

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

--- End quote ---

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.


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

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:


--- Code: ---// Did it work?
if (!$fp)
generateError($txt['paypal_could_not_connect']);
--- End code ---

What should I do?

live627:
Did you install any mods recently?

Navigation

[0] Message Index

[#] Next page

Go to full version