tletourneau Posted December 15, 2010 Share Posted December 15, 2010 Hi all, Could someone point me in the direction of how I would go about doing a POST to an external system when when a product addon is selected? What I need to do is send the following information whenever a client selects a specific addon. The form I have looks like this: <form action="http://####.####.###/common.php?dispatch=site/create_account" method="post"> <input type="hidden" name="account_data[name]" value="John Doe" /> <input type="hidden" name="account_data[email]" value="john@example.com" /> <input type="hidden" name="account_data[ip_address]" value="0.0.0.0" /> <input type="hidden" name="account_data[url]" value="http://www.example.com" /> <input type="hidden" name="account_data[creator]" value="############" /> <input type="hidden" name="account_data[product_id]" value="26" /> <input type="hidden" name="aak" value="#######" /> <input type="submit"> </form> The following would stay static: <input type="hidden" name="account_data[creator]" value="############" /> <input type="hidden" name="account_data[product_id]" value="26" /> <input type="hidden" name="aak" value="#######" /> But I need to pull the rest from the client info in WHMCS. I just can't figure out how to create an automated dynamic way to send the post. I tried to create a new email template to do it but couldn't get that to work. Any pointers will be greatly appreciated. Thanks, Tom 0 Quote Link to comment Share on other sites More sharing options...
thebizbuilder Posted December 15, 2010 Share Posted December 15, 2010 Hi Tom. Ill give u a few pointers. Im no expert but i have done a bit of work with whmcs! Firstly you will want to look at action hook. You can find them in the documentation on this site. You will likely use something like "aftermodulecreate" which basically will allow you to execute any php code u like when someones hosting package becomes active. Here you will be sent a set of variables mentioned in the documentation as $params this holds all you variables passed from whmcs. There is a list in the module creation documentation, in the template file. Then you have the task of posting the variables in your form. I suggest you do some reading on curl and php, and do a simple curl post execution. Its used everywhere over the web and there is plenty of info about it. I think paypal uses curl. There will be tutorials online about posting forms etc. I think that would be the best route to go down. If you have any other questions. Send them through! 0 Quote Link to comment Share on other sites More sharing options...
thebizbuilder Posted December 15, 2010 Share Posted December 15, 2010 Sorry but better than the aftermodule create would be the action hook named "addonactivation" duuh! Lol 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.