php-core / smspva
0.0.1
2023-07-18 16:44 UTC
Requires
- php: 8.*
- guzzlehttp/guzzle: ^7.7
README
SmsPva.com PHP SDK
此库需要最低 PHP 8.0
安装
composer require php-core/smspva
示例
获取号码
// 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";
}
其他示例可以在这里找到 这里
更多信息,请访问 官方 SMSPVA API 文档
许可
本项目采用 MIT 许可证。