Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split PHP page over 2 domains - send variables to 2nd domain and back again

I need to split a php page between two domains. That is, I need to send some variables (including arrays) to a second domain, where some calculations will be done using the variables, then I need to get the results back to the first domain.

Currently I have one php page that takes some variables, does calculations on them and shows the results. I want to share this functionality with owners of other domains while keeping secret how the calculations are done.

I think the best way to do this is to give them a php page that sends the variables to my domain, where the calculations are done, and then send the results back.

I am wondering what the best way to do this will be. I would appreciate a point in the right direction if anyone has done something similar.

Thanks

like image 402
avjaarsveld Avatar asked Oct 06 '22 17:10

avjaarsveld


1 Answers

If the sites using your data are going to be displaying it inline there, this sort of functionality would typically be done with AJAX. Make a page that accepts the variables, performs the calculations, and then outputs the results as JSON. The sites requiring calculations will simply POST their values to your page and capture the results, which are easily parsed in any language.

like image 125
Alex Howansky Avatar answered Oct 13 '22 12:10

Alex Howansky