ka0zstyle
New Member
- Joined
- Oct 30, 2009
- Messages
- 128
- Reaction score
- 2
It found several scripts to send an IPN to several servers but I don't know how to configure it for an ot Does anyone help me? It seems simple (for you who are pro xD <3 scripters)
In my main server I already have my IPN configured perfectly so I already have a notion of how these scripts work .. I am not so at zero, so if someone explains to me "without so many details" I think I can understand thank you very much <3
If I am not mistaken, this script will detect the IPN "Name_item" of paypal and depending on the name of the NAME_ITEM it will send an IPN to the server that corresponds to it, right?
PHP:
<?php
ini_set( 'max_execution_time', 0 ); // Do not abort with timeouts
ini_set( 'display_errors', 'Off' ); // Do not display any errors to anyone
$urls = array(); // The broadcast session queue
// List of IPN listener points ** ADJUST THESE TO POINT TO YOUR LISTENERS
$ipns = array(
'first' => 'http://www.yourwebsite1.co.uk//paypal/ipn.php',
'second' => 'http://www.yourwebsite2.co.uk//paypal/ipn.php',
'third' => 'http://www.yourwebsite3.co.uk//paypal/ipn.php'
);
// ** ADJUST THESE CONDITIONS TO FILTER
if($_POST['txn_type']!='cart') $urls []= $ipns['first']; // Choose this IPN URL if all conditions have been met
if(isset($_POST['auction_buyer_id'])) $urls []= $ipns['second']; // Choose this IPN URL if all conditions have been met
$urls []= $ipns['third']; // maybe this one is always sent to
// Broadcast
if ( !sizeof($urls) ) $urls = $ipns; // No URLs have been matched
$urls = array_unique( $urls ); // Unique, just in case
// Broadcast (excluding IPNs from the list according to filter is possible
foreach ( $urls as $url ) broadcast( $url );
header( 'HTTP/1.1 200 OK', true, 200 );
exit();
// Perform a simple cURL-powered proxy request to broadcast
function broadcast( $url ) {
// Format POST data accordingly
$data = array();
foreach ($_POST as $key => $value) $data []= urlencode($key).'='.urlencode($value);
$data = implode('&', $data);
// Log the broadcast
file_put_contents('_logs/'.time().'.'.reverse_lookup( $url ).'-'.rand(1,100), $data);
$ch = curl_init(); // Initialize
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($data));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch); // Execute HTTP request
curl_close($ch); // Close
}
function reverse_lookup( $url ) {
global $ipns;
foreach ( $ipns as $tag => $_url ) {
if ( $url == $_url ) return $tag;
}
return 'unknown';
}
?>
PHP:
<?php
ini_set( 'max_execution_time', 0 ); // Do not abort with timeouts
ini_set( 'display_errors', 'Off' ); // Do not display any errors to anyone
$urls = array(); // The broadcast session queue
// List of IPN listener points ** ADJUST THESE TO POINT TO YOUR LISTENERS
$ipns = array(
'first' => 'http://www.yourwebsite1.co.uk//paypal/ipn.php',
'second' => 'http://www.yourwebsite2.co.uk//paypal/ipn.php',
'third' => 'http://www.yourwebsite3.co.uk//paypal/ipn.php'
);
// ** ADJUST THESE CONDITIONS TO FILTER
if($_POST['txn_type']!='cart') $urls []= $ipns['first']; // Choose this IPN URL if all conditions have been met
if(isset($_POST['auction_buyer_id'])) $urls []= $ipns['second']; // Choose this IPN URL if all conditions have been met
$urls []= $ipns['third']; // maybe this one is always sent to
// Broadcast
if ( !sizeof($urls) ) $urls = $ipns; // No URLs have been matched
$urls = array_unique( $urls ); // Unique, just in case
// Broadcast (excluding IPNs from the list according to filter is possible
foreach ( $urls as $url ) broadcast( $url );
header( 'HTTP/1.1 200 OK', true, 200 );
exit();
// Perform a simple cURL-powered proxy request to broadcast
function broadcast( $url ) {
// Format POST data accordingly
$data = array();
foreach ($_POST as $key => $value) $data []= urlencode($key).'='.urlencode($value);
$data = implode('&', $data);
// Log the broadcast
file_put_contents('_logs/'.time().'.'.reverse_lookup( $url ).'-'.rand(1,100), $data);
$ch = curl_init(); // Initialize
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($data));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch); // Execute HTTP request
curl_close($ch); // Close
}
function reverse_lookup( $url ) {
global $ipns;
foreach ( $ipns as $tag => $_url ) {
if ( $url == $_url ) return $tag;
}
return 'unknown';
}
?>
In my main server I already have my IPN configured perfectly so I already have a notion of how these scripts work .. I am not so at zero, so if someone explains to me "without so many details" I think I can understand thank you very much <3
If I am not mistaken, this script will detect the IPN "Name_item" of paypal and depending on the name of the NAME_ITEM it will send an IPN to the server that corresponds to it, right?