Convert simple PHP script to Javascript
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need a simple PHP script converted into a static Javascript script which can be run in a browser. The PHP script essentially does the following:

  1. Send some data to a URL using POST request
  2. Encrypt some of the data using RSA before sending

If you open the attached zip file from here:

And launch "index.php" in browser, it will send the POST request and redirect you to the target URL.

I just need the PHP script converted into a static Javascript script which can be run in a browser


Hi user0809, I have seen your code i don't think we will be able to convert the above to javascript because you have class file and private/public keys to convert your info. I HAVE THE SOLUTION if you are interested semi javascript to use in browser.
Subhash Dasyam 1 year ago
What’s the semi JavaScript solution?
user0809 1 year ago
as @Subhash said, you have a php class, and i can see many secured informations, so we can make a semi js code, that will post the values to a PHP page in your server (the same index file you have), that will keep working like it is right now. Or another solution, following @cueball suggestion, to use the HTML5SDK and i will use another RSA encryption script. and for encryption, you want everyfield encrypted alone? or all together encrypted? like in HTML5SDK solution?
Chlegou 1 year ago
@Chlegou if possible I'd prefer the second solution which uses the HTML5 SDK. Concerning the encryption, I don't really mind which one as long as it's able to redirect to the same target page as in the demo PHP code :)
user0809 1 year ago
i have posted my bounty, please check it
Chlegou 1 year ago
awarded to Chlegou

Crowdsource coding tasks.

2 Solutions

Hi, the iTP-Pay page already offers two javascript SDK solutions, here:

For a fully client side solution then use the HTML5 package.


The thing is, their client side solution is meant for another payment portal and when applied to my needs, their client side solution has an issue with the RSA encryption method they use. This was told to me by their tech support. Are you able to modify the PHP script?
user0809 1 year ago
Winning solution

Hi again,

Hope didn't take too much time to give an answer, as you didn't required the RSA encryption, i used the standard encryption itpay provide.

all you require, is your appID and your key as private parameters and some other required fiels to send a post request to itpay.

Code is available in GitHub and you can try the demo online also.

Repository link:

Demo link:

(i have verified that it redirect to the same page you have in PHP files, with same results)

Note: Please, Make sure to change your key and the app ID since they are published now in github!!

Hope this is what you need. i'm online, ask any questions you have.

Thanks so much! This works great now! :D Cheers
user0809 1 year ago
thanks for rewarding the bounty :)
Chlegou 1 year ago
View Timeline