如何在 Nexmo 中向美国号码发送文本 [英] how to send text to US numbers in Nexmo

查看:22
本文介绍了如何在 Nexmo 中向美国号码发送文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向菲律宾发送消息就像馅饼一样简单.

Sending message to Philippines is simple as pie.

但在美国号码中,我将不得不通过我不知道如何进行的验证.

But in US numbers, I'll have to go through verification that I do not know how.

我开始了 2F 身份验证,但似乎我不知道下一步该怎么做.

I started 2F Authentication but seems that I dont know how to do next.

我的问题:如何在 Nexmo 中添加发送文本到美国号码?

推荐答案

您可以使用 Nexmo 的 SMS API,它允许您通过简单的 HTTP 调用向 200 多个国家/地区发送文本.

You can use Nexmo's SMS API which allows you to send a text in over 200 countries with a simple HTTP call.

您可以注册一个虚拟号码,该号码允许您发送短信和;接收传入的消息.

You can sign up for a virtual number which allows you to send SMS messages & receive incoming message as well.

对于 2FA,您可以使用验证 API 对特定设备的用户进行身份验证.

For 2FA, you can use the Verify API to authenticate users to a specific device.

这种方法比使用 SMS API 和自己随机生成号码更安全.然后终端用户将输入该密码.由验证 API 检查.

This method is more secure than using an SMS API and randomly generating numbers yourself. The pin will then entered by the end user & checked by the Verify API.

使用这些 API 都需要几行代码.下面是一段 PHP 代码,它允许您使用 SMS API 发送文本.

It takes a few lines of code to use either of these APIs. Below is a block of code in PHP which allows you to send a text using the SMS API.

<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query([
'api_key' => API_KEY,
    'api_secret' => API_SECRET,
    'to' => YOUR_NUMBER,
    'from' => NEXMO_NUMBER,
    'text' => 'Hello from Nexmo'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

这里是 Nexmo 的 SMS API 的文档供参考.

Here is the documentation for Nexmo's SMS API for reference.

如果您正在寻找一个简单的 2FA,这里是 Nexmo 的验证 API 的文档解决方案.

Here is the documentation for Nexmo's Verify API if you were looking for a simple 2FA solution.

这篇关于如何在 Nexmo 中向美国号码发送文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆