magnussolution / magnusbilling-api

PHP wrapper for the MagnusBilling API
10 stars 11 forks source link

Unable to update caller id #9

Open Vineet-23 opened 11 months ago

Vineet-23 commented 11 months ago

Hi there,

I am trying yo update the caller id but every time its throwing as error as "Failed to get user ID"

below is my script

<?php

require_once "vendor/autoload.php";

use magnusbilling\api\magnusBilling;

// MagnusBilling API Configuration

$magnusBilling = new MagnusBilling('6966608921:AAFhgWEe123423gfvfdcdcd', '232@6966608921:AAFhgWEe123423gfvfdcdcd');

$magnusBilling->public_url = "http://xyz.com/mbilling"; // Your MagnusBilling URL

//get ID for username 24320

$id_user_result = $magnusBilling->getId('user', 'username', '24320');

// Check the result for more details

echo "ID Retrieval Result: " . print_r($id_user_result, true) . PHP_EOL;

// Check the result for more details

echo "ID Retrieval Result: " . print_r($id_user_result, true) . PHP_EOL;

// Check if the ID retrieval was successful

if ($id_user_result['status'] === 'success') {

$id_user = $id_user_result['data']['id'];

// Define the new callerid value

$newCallerID = '1234';

// Update the caller ID

$updateResult = $magnusBilling->update('user', $id_user, ['callerid' => $newCallerID]);

// Display the result of the update operation

echo "Update Result: " . print_r($updateResult, true) . PHP_EOL;

} else {

echo "Failed to get user ID. Error: " . $id_user_result['message'] . PHP_EOL;

echo "Details: " . print_r($id_user_result, true) . PHP_EOL;

}

Please suggest if i am doing something wrong.

Thanks in advance

kshontop commented 10 months ago

Did you find it?

Vineet-23 commented 10 months ago

Not yet. facing issue with user authentication. By any chance do you have any solution?

kshontop commented 10 months ago

Yes add me on discord konotop

kshontop commented 10 months ago

my discord : kshontop