<?php
/*
Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
<mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
*/
@ignore_user_abort(true);
/*
---- Central IPN Processing: ---------------------------------------------------------------------------------
With PayPal® Pro integration you absolutely MUST set an IPN URL inside your PayPal® account.
PayPal® Pro integration does NOT allow the IPN location to be overridden on a per-transaction basis.
So ... if you're using a single PayPal® Pro account for multiple cross-domain installations,
and you need to receive IPN notifications for each of your domains; you'll want to create
a central IPN processing script that scans variables in each IPN response,
forking itself out to each of your individual domains.
In rare cases when this is necessary, you'll find two variables in all IPN responses for s2Member.
The originating domain name will always be included somewhere within, either:
`custom` and/or `rp_invoice_id`; depending on the type of transaction.
These variables can be used to test incoming IPNs, and fork to the proper installation.
---- Instructions: -------------------------------------------------------------------------------------------
1. Set the IPN URL ( in your PayPal® account ) to the location of this script on your server.
This central processor forks IPNs out to a particular installation of s2Member ( on a particular domain ).
2. Now, here's where the magic happens ( PLEASE CHANGE: www.site1.com, www.site2.com. ).
*/
if (stripos ($_POST["custom"], "www.site1.com") !== false || stripos ($_POST["rp_invoice_id"], "www.site1.com") !== false)
curlpsr ("http://www.site1.com/?s2member_paypal_notify=1", http_build_query ($_POST));
/**/
elseif (stripos ($_POST["custom"], "www.site2.com") !== false || stripos ($_POST["rp_invoice_id"], "www.site2.com") !== false)
curlpsr ("http://www.site2.com/?s2member_paypal_notify=1", http_build_query ($_POST));
/*
This is just a utility function ( you must have the cURL extension for PHP enabled ).
*/
function curlpsr ($url = FALSE, $postvars = array (), $max_con_secs = 20, $max_stream_secs = 20, $headers = array ())
{
if (($url = trim ($url)) && ($c = curl_init ()))
{
if (is_array ($postvars)) /* Because cURL can't deal with complex arrays. */
/* Since cURL can't deal with complex arrays, we force this to a query string. */
$postvars = http_build_query ($postvars);
/**/
curl_setopt_array ($c, /* Configure options. */
array (CURLOPT_URL => $url, CURLOPT_POST => true,/**/
CURLOPT_FOLLOWLOCATION => false, CURLOPT_MAXREDIRS => 0,/**/
CURLOPT_CONNECTTIMEOUT => $max_con_secs, CURLOPT_TIMEOUT => $max_stream_secs, /* Initial connection & stream seconds. */
CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $postvars,/**/
CURLOPT_ENCODING => "", CURLOPT_VERBOSE => false, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
/**/
$o = trim (curl_exec ($c));
/**/
curl_close($c);
}
/**/
return (!empty ($o)) ? $o : false;
}
?>
Statistics: Posted by Jason Caldwell — April 29th, 2011, 1:13 pm
Statistics: Posted by flip4520 — November 23rd, 2010, 2:54 pm
Statistics: Posted by Jason Caldwell — November 19th, 2010, 9:16 pm
Statistics: Posted by flip4520 — November 18th, 2010, 2:23 pm
accept_via_paypal="paypal,visa,mastercard,amex,discover,maestro,solo"
Statistics: Posted by Jason Caldwell — August 18th, 2010, 12:28 am
Statistics: Posted by Elizabeth — August 13th, 2010, 11:10 am
Statistics: Posted by schop — August 13th, 2010, 8:38 am