Page 1 of 1

Possible to POST IPN Script to Two Different URL's?

Posted: Sun Feb 18, 2007 6:54 pm
by Superman859
I'm setting up an affiliate program on my server using affiliate software. In order to track commissions,etc it uses Paypal IPN. You tell Paypal to POST the IPN data to the affiliate script, which then tracks it all.

However, I also need to use IPN data and already have a script written for it - I've been using the script long before I started looking into affiliate programs.

If Paypal POSTs data to the affiliate page, is there a way to tell that affiliate script to send a copy of the data over to my IPN script? I mainly need the variables - I don't need to POST back to Paypal if that has already been completed by the affiliate script.

However, I'm unsure of how to get those variables transferred without any interference. I know you can use a form and POST them, etc. or attach them onto a URL for GET. I don't want to use those methods though - I want it to transfer the values and variables over without the user clicking anything. I haven't tested it yet, but I imagine that the affiliate program script is set up to automatically redirect visitors back to my main site once the script runs. I need to find a way to get the variables to my own script as well.

Is this possible?

Posted: Sun Feb 18, 2007 7:21 pm
by Kieran Huggins
maybe you could serialize the $_POST array and send it via a CURL post?

Posted: Sun Feb 18, 2007 8:36 pm
by Superman859
Actually I have an idea that may work...let me know if you think this should work....

I can let Paypal POST to the affiliate script. The script can do whatever it needs to do.

I can then simply copy and paste the majority of my code that was in my own IPN script and place it at the bottom of the affiliate script. My script will connect to a different database, and then continue to use the same variables that the affiliate script used...Since neither my script nor the affiliate script alters those variables and simply runs tests against them, it should work to simply add my script onto the end of the other, right?

Once that script is done, it no longer needs to be connected to the affiliate database, and I can do as I please...should it work?

Posted: Sun Feb 18, 2007 8:53 pm
by Kieran Huggins
sure - maybe you could even just include() your script (locally) - saves hassle

Posted: Sun Feb 18, 2007 9:13 pm
by Superman859
The only problem with directly including the script is my script posts back to Paypal, and so does their script. Rather than posting information back to Paypal twice, I could just eliminate that part...

Hopefully it should work though. Thanks.