Jump to content

API Command Not Found (Sigh ... why?)


aamche

Recommended Posts

I'm writing code to work with the API and no matter how many examples I copy it simply doesn't work. It seems to authenticate fine, IP is allowed, it just can't process any actions (commands).

 

I just keep receiving

The following error occured: Command Not Found

 

It seems pretty self explanatory, the value for action is wrong. I tried many out of the API documentation, which fail, so I'm not sure where to go from here.

 

	$postfields["username"] = $this->whmcs_user;
	$postfields["password"] = md5($this->whmcs_pass);
	$postfields["action"] = "encryptpassword";
	$postfields["password2"] = 'xxxxxx';

	$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"];
	}

Link to comment
Share on other sites

  • 2 weeks later...
  • 11 months later...
  • 2 months later...

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