SDK Upgrade (Legacy to Active)
Upgrade from PHP SDK Legacy to v4.25.0 or Latest Version
Migrate from legacy PHP SDK to v4.25.0+ — code changes required
Was this page helpful?
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Migrate from legacy PHP SDK to v4.25.0+ — code changes required
<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;
$p = new RestAPI($auth_id, $auth_token);
$client = new RestClient("<auth_id>","<auth_token>");
$response = $p->make_call($params);
$response = $client->calls->create($params);
<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "<auth_id>";
$auth_token = "<auth_token>";
$p = new RestAPI($auth_id, $auth_token);
$params = array(
'to' => '2025552323',
'from' => '2025551212',
'answer_url' => "https://s3.amazonaws.com/static.plivo.com/answer.xml",
'answer_method' => "GET"
);
$response = $p->make_call($params);
print_r ($response);
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
$response = $client->calls->create(
'+12025551212',
['+12025552323'],
'https://s3.amazonaws.com/static.plivo.com/answer.xml',
);
print_r($response);
}
catch (PlivoRestException $ex) {
print_r($ex);
}
<?php
require '../vendor/autoload.php';
use Plivo\Response;
$response = new Response();
$params = array(
'dialMusic' => "https://<yourdomain>.com/dial_music/"
);
$dial = $response->addDial($params);
$number = "12025552323";
$dial->addNumber($number);
Header('Content-type: text/xml');
echo($response->toXML());
<?php
require '../vendor/autoload.php';
use Plivo\Response;
$response = new Response();
$params = array(
'dialMusic' => "https://<yourdomain>.com/dial_music/"
);
$dial = $response->addDial($params);
$number = "12025552323";
$dial->addNumber($number);
Header('Content-type: text/xml');
echo($response->toXML());
<?php
require '../vendor/autoload.php';
use Plivo\Response;
$response = new Response();
$params = array(
'startConferenceOnEnter' => "false",
'waitSound' => "https://<yourdomain>.com/waitmusic/"
);
$conference_name = "My Room";
$response->addConference($conference_name, $params);
Header('Content-type: text/xml');
echo($response->toXML());
<?php
require '../vendor/autoload.php';
use Plivo\Response;
$response = new Response();
$params = array(
'startConferenceOnEnter' => "false",
'waitSound' => "https://<yourdomain>.com/waitmusic/"
);
$conference_name = "My Room";
$response->addConference($conference_name, $params);
Header('Content-type: text/xml');
echo($response->toXML());
<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "<auth_id>";
$auth_token = "<auth_token>";
$p = new RestAPI($auth_id, $auth_token);
$params = array('call_uuid' => $uuid);
$response = $p->record($params);
print("URL : {$response['response']['url']}");
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
$response = $client->calls->startRecording(
'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
);
print_r($response);
}
catch (PlivoRestException $ex) {
print_r($ex);
}
<?php
require '../vendor/autoload.php';
use Plivo\Response;
$response = new Response();
$params = array(
'action' => "https://<yourdomain>.com/get_recording/",
'startOnDialAnswer' => "true",
'redirect' => "false"
);
$response->addRecord($params);
$dial = $response->addDial();
$number = "2025552323";
$dial->addNumber($number);
Header('Content-type: text/xml');
echo($response->toXML());
<?php
require '../vendor/autoload.php';
use Plivo\Response;
$response = new Response();
$params = array(
'action' => "https://<yourdomain>.com/get_recording/",
'startOnDialAnswer' => "true",
'redirect' => "false"
);
$response->addRecord($params);
$dial = $response->addDial();
$number = "2025552323";
$dial->addNumber($number);
Header('Content-type: text/xml');
echo($response->toXML());
Was this page helpful?