Skip to content

Fatal error: Uncaught Error: Class "Vonage\Message\Viber\ViberText" not found in /home/zvanywebadmin/public_html/vishnuapi/index.php:26 Stack trace: #0 {main} thrown in /home/zvanywebadmin/public_html/vishnuapi/index.php on line 26 #96

Open
@vishnuchoudhary2822

Description

@vishnuchoudhary2822

`<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require_once 'vendor/autoload.php';

use Vonage\Client;
use Vonage\Client\Credentials\Keypair;

// Set your Vonage API credentials
$apiKey = 'xxxxx';
$apiSecret = 'xxxxx';
$applicationId = 'xxxxxxxxx';
$privateKeyPath = './private.key'; // Path to your private key file

// Create Vonage API client
$credentials = new Keypair($apiKey, $privateKeyPath);
$client = new Client($credentials);

// Set the recipient and sender numbers
$toNumber = 'xxxxxxxxx'; // Replace with the recipient's Viber number
$fromNumber = 'xxxxxxxxxx'; // Replace with your Viber number associated with the application

// Create Viber text message
$viber = new \Vonage\Message\Viber\ViberText(
$toNumber,
$fromNumber,
'This is a text message sent using the Vonage PHP SDK'
);

// Send the Viber message
$response = $client->message()->send($viber);

// Handle the response
if ($response->getStatus() == 0) {
echo 'Viber message sent successfully!';
} else {
echo 'Error sending Viber message. Error code: ' . $response->getMessages()[0]->getStatus();
`}``

Screenshot 2023-11-28 at 7 00 55 PM

Need help Can you Please check my what's the issue

I want to send messages through Vonage WhatsApp API. but it's showing error below

Fatal error: Uncaught Error: Class "Vonage\Message\Viber\ViberText" not found in /home/zvanywebadmin/public_html/vishnuapi/index.php:26 Stack trace: #0 {main} thrown in /home/zvanywebadmin/public_html/vishnuapi/index.php on line 26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions