Jump to content

Bulk transfer page not accepting POST requets


arrowe

Recommended Posts

Hi All,

 

Iv'e been working on integrating WHMCS into our main site. We have a hosting page, into which I have inserted the form from Utilitys->Intergration Code for domain lookups. This works flawlessly, and I applaud the developers for the ease and speed that the system can be integrated into other sites.

 

However, we were also aiming to have a bulk transfer textarea, similar to /domainchecker.php?search=bulktransfer , on our hosting page, to post to our WHMCS system. However, whenever the form is posted, I get redirected to the logon, wether I'm logged in or not.

 

You can access the page, by navigating to it, without having to log in. The form code, on the normal site, is as follows:

 

<form action="https://whmcs.mydomain.co.uk/domainchecker.php?search=bulktransfer" method="post">

<input type="hidden" name="token" value="therandomtokengoeshere" />

<input type="hidden" name="direct" value="true" />

<textarea name="bulkdomains" srows="1" cols="30" style="resize: none;width:98%"></textarea><br/><br/>

<input type="submit" id="domtranbutton" value="Transfer Domains" />

</form>

 

I have obsured our domain, as it is still in development, and the token for obvious reasons.

The Id on the button is purely for styling.

 

Submission of the form leads to whmcs.mydomain.co.uk/clientarea.php, via a 302 Found redirect at https://whmcs.mydomain.co.uk/domainchecker.php?search=bulktransfer

 

I have scoured the documentation, and can find no reason as to why this isnt working.

 

If anyone has any advice unto why this behaviour is occouring, it would be very much appriciated.

 

Best,

 

Arrowe

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

I think you will need to create a session.

 

<?php

 

$url = "http://www.yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file

$username = "Admin"; # API user username goes here

$password = "demo"; # API user password goes here

 

$postfields["username"] = $username;

$postfields["password"] = md5($password);

$postfields["action"] = "addinvoicepayment"; #action performed by the [[API:Functions]]

$postfields["invoiceid"] = "1";

$postfields["transid"] = "TEST";

$postfields["gateway"] = "mailin";

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 100);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$data = curl_exec($ch);

curl_close($ch);

 

$data = explode(";",$data);

foreach ($data AS $temp) {

$temp = explode("=",$temp);

$results[$temp[0]] = $temp[1];

}

 

if ($results["result"]=="success") {

# Result was OK!

} else {

# An error occured

echo "The following error occured: ".$results["message"];

}

 

?>

 

 

...and then post the domains : http://docs.whmcs.com/API:Register_Domain

Link to comment
Share on other sites

In General Settings > Security there are some undocumented settings that might help you. I can't tell you the name because in WHMCS 5.1.X they have no name at all.

 

Hi,

 

Possible for you to send us a screenshot of those options without any name, so we can see what are those options? :)

 

...have you tried using a default language file? Sometimes, when this happen, it's because there is something missing in the language file. possible?

 

- - - Updated - - -

 

is it the tokens?

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