Paypal IPN HELP!

Discussion in 'PayPal' started by wamchu, Jun 27, 2006.

  1. #1
    I have two site (eg wwww.mydomain.com and wwww.mydomain2.com) which i need to update using paypal IPN (Instant Payment Notification). Currently I can only update one site. Is there anyway to update both of the site.
    Paypal only allow one ipn update eg wwww.mydomain.com/ipn.html. Pls let me know if i can update more than one domain.
     
    wamchu, Jun 27, 2006 IP
  2. wamchu

    wamchu Peon

    Messages:
    2,133
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    0
    #2
    So no one can Help !
     
    wamchu, Jun 28, 2006 IP
  3. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Can you make one site update the other?
     
    Perrow, Jun 28, 2006 IP
  4. wamchu

    wamchu Peon

    Messages:
    2,133
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Not sure how to do that.
     
    wamchu, Jun 28, 2006 IP
  5. abuzant

    abuzant Well-Known Member

    Messages:
    956
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Assuming that your IPN validation script is called validate.php at both domains:

    - Domain one:
    At the end of the validate.php file, add the following code:
    
    $variables2pass = array_merge($_POST, $_GET);
    bi_validate($variables2pass);
    
    function bi_validate($_dvalues) 
    { 
    	//	Settings Array
    	$ch = curl_init(); 
    	curl_setopt ($ch, CURLOPT_URL,"http://www.domain2.com/validate.php"); 
    	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    	curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); 
    	curl_setopt ($ch, CURLOPT_TIMEOUT, 20); 
    	curl_setopt ($ch, CURLOPT_FOLLOWLOCATION,1); 
    	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
    	curl_setopt ($ch, CURLOPT_POSTFIELDS, $_dvalues); 
    	curl_setopt ($ch, CURLOPT_POST, 1); 
    	$result = curl_exec ($ch); 
    	curl_close($ch); 
    	return $result;
    }
    
    PHP:
    This requires cURL to be installed at your server. Please also notice that this is pseude code, some typos might exist :D
     
    abuzant, Jun 28, 2006 IP
  6. wamchu

    wamchu Peon

    Messages:
    2,133
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for the code. What is cURL ?
     
    wamchu, Jun 29, 2006 IP
  7. abuzant

    abuzant Well-Known Member

    Messages:
    956
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    140
    #7
    In a couple of words, it's a PHP extension thar works just like the PEAR:Request module, more at http://curl.haxx.se/ :D
     
    abuzant, Jun 29, 2006 IP