Jump to content

Api add client error version 5.2


levelman

Recommended Posts

API REWQEST

 

 

<?php

 

/* * ** WHMCS JSON API Sample Code *** */

 

$url = "http://bp.craftgamer.ru/includes/api.php"; # URL to WHMCS API file goes here

$username = "******"; # Admin username goes here

$password = "******"; # Admin password goes here

 

$postfields = array();

$postfields["username"] = $username;

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

$postfields["action"] = "addclient";

$postfields["firstname"] = "Test";

$postfields["lastname"] = "User";

$postfields["companyname"] = "WHMCS";

$postfields["email"] = "demo@whmcs.com";

$postfields["address1"] = "123 Demo Street";

$postfields["city"] = "Demo";

$postfields["state"] = "Florida";

$postfields["postcode"] = "AB123";

$postfields["country"] = "US";

$postfields["phonenumber"] = "123456789";

$postfields["password2"] = "demo";

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

$postfields["responsetype"] = "json";

 

$query_string = "";

foreach ($postfields AS $k => $v)

$query_string .= "$k=" . urlencode($v) . "&";

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 30);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

$jsondata = curl_exec($ch);

if (curl_error($ch))

die("Connection Error: " . curl_errno($ch) . ' - ' . curl_error($ch));

curl_close($ch);

 

$arr = json_decode($jsondata); # Decode JSON String

 

print_r($arr); # Output XML Response as Array

 

 

 

echo "<textarea rows=50 cols=100>Request: ".print_r($postfields,true);

echo "\nResponse: ".htmlentities($jsondata)."\n\nArray: ".print_r($arr,true);

echo "</textarea>";

 

?>

 

 

 

 

 

 

 

Request: Array

(

[username] => AdminApi

[password] => 5fe03afff2a1d66efa255610fa79fb47

[action] => addclient

[firstname] => Test

[lastname] => User

[companyname] => WHMCS

=> demo@whmcs.com

[address1] => 123 Demo Street

[city] => Demo

[state] => Florida

[postcode] => AB123

[country] => US

[phonenumber] => 123456789

[password2] => demo

[customfields] => YToxOntpOjE7czo2OiJHb29nbGUiO30=

[currency] => 1

[responsetype] => json

)

 

Response: {"result":"error","message":"1 Invalid Select Option<\/li>"}

 

Array: stdClass Object

(

[result] => error

[message] => 1 Invalid Select Option</li>

 

 

[result] => error

[message] => 1 Invalid Select Option</li> - What is?

 

All functions work but add client is not work

Edited by levelman
Link to comment
Share on other sites

phpinfo

 

 

 

 

curl

cURL support enabled

cURL Information 7.22.0

Age 3

Features

AsynchDNS No

Debug No

GSS-Negotiate Yes

IDN Yes

IPv6 Yes

Largefile Yes

NTLM Yes

SPNEGO No

SSL Yes

SSPI No

krb4 No

libz Yes

CharConv No

Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet, tftp

Host x86_64-pc-linux-gnu

SSL Version OpenSSL/1.0.1

ZLib Version 1.2.3.4

Link to comment
Share on other sites

curl

cURL support enabled

cURL Information 7.22.0

Age 3

Features

AsynchDNS No

Debug No

GSS-Negotiate Yes

IDN Yes

IPv6 Yes

Largefile Yes

NTLM Yes

SPNEGO No

SSL Yes

SSPI No

krb4 No

libz Yes

CharConv No

Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet, tftp

Host x86_64-pc-linux-gnu

SSL Version OpenSSL/1.0.1

ZLib Version 1.2.3.4

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