Skip to content

php-core/smspva

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smspva

SmsPva.com PHP SDK


This library requires min. PHP 8.0

Installation

composer require php-core/smspva

Examples

Get number

// require_once './vendor/autoload.php';

// Replace 'YOUR_API_KEY' with your actual API key from SMS PVA.
$apiKey = 'YOUR_API_KEY';

try {
	$api = new PHPCore\SmsPva\Api($apiKey);

	// Example: Getting a number for a specific service and country.
	$service = 'tg'; // Service code for Telegram (tg)
	$country = 'RU'; // Country code for Russia (RU)

	$response = $api->getNumber($service, $country);

	// Check the response to see if the request was successful.
	if (isset($response['number'])) {
		$number = $response['number'];
		$tzid = $response['id'];

		echo "Received number: $number\n";

		// Perform your actions with the received number.
		// ...
	} else {
		echo "Error: " . $response['error'] . "\n";
	}
} catch (Exception $e) {
	echo "Error: " . $e->getMessage() . "\n";
}

Other examples can be found here



License

This project is licensed under the MIT License.