Rizwan Posted April 6, 2022 Share Posted April 6, 2022 Hi Guys, When i try to connection database using Capsule for clinets data, i am getting null as response Here is Code for getting clients data 0 Quote Link to comment Share on other sites More sharing options...
1 DennisHermannsen Posted April 6, 2022 Share Posted April 6, 2022 You didn't include the code you're using. 0 Quote Link to comment Share on other sites More sharing options...
0 Alexxxcfr Posted September 14, 2022 Share Posted September 14, 2022 Im getting the same problem, just null values. I added the ip addres under the security tab to allow it to connect using the API. This is my code. Thanks in advance.. <?php // API Connection Details $whmcsUrl = "mysystemurl"; $api_identifier = "identifierhere"; $api_secret = "secrethere"; $api_accesskey = "Apiaccesshere"; // Set post values $postfields = array( 'identifier' => $api_identifier, 'secret' => $api_secret, 'accesskey' => $api_accesskey, 'action' => 'GetTickets', 'responsetype' => 'json', ); // Call the API $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); $response = curl_exec($ch); if (curl_error($ch)) { die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch)); echo "Voy a decode entrando aqui error"; } curl_close($ch); //print_r($results); // Decode response $jsonData = json_decode($response, true); // Dump array structure for inspection var_dump($jsonData); //echo $response; //var_dump($response); ?> 0 Quote Link to comment Share on other sites More sharing options...
0 PUQ Posted December 20, 2022 Share Posted December 20, 2022 On 9/14/2022 at 7:32 AM, Alexxxcfr said: Im getting the same problem, just null values. I added the ip addres under the security tab to allow it to connect using the API. This is my code. Thanks in advance.. <?php // API Connection Details $whmcsUrl = "mysystemurl"; $api_identifier = "identifierhere"; $api_secret = "secrethere"; $api_accesskey = "Apiaccesshere"; // Set post values $postfields = array( 'identifier' => $api_identifier, 'secret' => $api_secret, 'accesskey' => $api_accesskey, 'action' => 'GetTickets', 'responsetype' => 'json', ); // Call the API $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); $response = curl_exec($ch); if (curl_error($ch)) { die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch)); echo "Voy a decode entrando aqui error"; } curl_close($ch); //print_r($results); // Decode response $jsonData = json_decode($response, true); // Dump array structure for inspection var_dump($jsonData); //echo $response; //var_dump($response); ?> It looks like you are trying to use the WHMCS API to retrieve a list of tickets from your WHMCS installation. There could be a few reasons why you are getting null values in the response. Here are a few things you can try: Make sure you have entered the correct URL for your WHMCS installation in the $whmcsUrl variable. This should be the base URL for your WHMCS installation, including the http:// or https:// prefix, but not including the /includes/api.php part. Make sure you have entered the correct API identifier, secret, and access key in the $api_identifier, $api_secret, and $api_accesskey variables, respectively. These values can be found in the "API Credentials" section of the "Setup > General Settings > Security" page in the WHMCS admin area. Make sure the IP address of the server that you are running this script on is added to the list of allowed IP addresses in the "API IP Access Restriction" section of the "Setup > General Settings > Security" page in the WHMCS admin area. Make sure you are using the correct action name in the action parameter of your API request. In this case, you are using the GetTickets action, which should return a list of tickets. However, if you want to retrieve a specific ticket, you can use the GetTicket action and specify the ticketid parameter with the ID of the ticket you want to retrieve. Make sure you are using the correct response type in the responsetype parameter of your API request. In this case, you are using the json response type, which will return the response as a JSON-encoded string. If you want to receive the response as an array, you can use the array response type instead. 0 Quote Link to comment Share on other sites More sharing options...
Question
Rizwan
Hi Guys,
When i try to connection database using Capsule for clinets data, i am getting null as response
Here is Code for getting clients data
Link to comment
Share on other sites
3 answers to this question
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.