Jump to content

Create a POST on product addon.


tletourneau

Recommended Posts

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated