-
Notifications
You must be signed in to change notification settings - Fork 1
/
paypal_multiple_ipn.php
69 lines (54 loc) · 1.78 KB
/
paypal_multiple_ipn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* ==========================================
*
* Modifiez uniquement les URL ci-dessous.
* Vous pouvez rajouter autant d'IPN que vous souhaitez.
*
* ==========================================
*/
$ipns = array(
'clickfunnels' => 'http://.......',
'zapier' => 'http://.......'
);
/**
* ==========================================
*
* NE TOUCHEZ RIEN EN DESSOUS DE CETTE LIGNE /!\
*
* ==========================================
*/
// PHP set up
ini_set( 'max_execution_time', 0 ); /* Do not abort with timeouts */
ini_set( 'display_errors', 'Off' ); /* Do not display any errors to anyone */
/* Broadcast */
$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(); /* Thank you, bye */
/* 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';
}
?>