PHP中的短信网关和API
我正在尝试在注册后通过短信发送用户凭据。可以通过 HTTP API 使用 GET 方法访问网关。因此我想将其集成到我的 Registration_process.php 文件中,以便在数据库中输入详细信息后立即发送短信应该交付。
GET 方法类似于
http://gatewayprovider?user=<username>&password=<password>&msg=<$my msg>&no=<$receiver no>
那么如何在用户不知情的情况下调用此 url。这是一种安全的方式,
谢谢。
I'm trying to send user credentials via sms after registration.The gateway can be accessed using GET method via HTTP API.So I want to integrate it into my registration_process.php file so that as soon as the details are entered in db the sms should be delivered .
The GET method is similar to
http://gatewayprovider?user=<username>&password=<password>&msg=<$my msg>&no=<$receiver no>
So how can I call this url without any knowledge to the user. That is in a secure manner
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果网络服务器上已安装并启用了 cURL,则您可以cURL。
稍微修改 来自 php.net 的示例
当你说
我几乎不敢相信以明文形式发送数据作为 http GET 请求是安全的。
这些数据对于用户来说是不可见的,但任何嗅探您数据的人都可以读取它。网关提供https吗?
与
POST
方法相反,使用GET
发送数据并不真正安全,因为请求 url 将在日志中可见,考虑到防火墙等。这当然是在从您的服务器到短信网关的路由上。如果您的短信网关支持,
POST
+HTTPS
将是最佳选择。 cURL 也是在这里使用的理想选择。如果您没有安装 cUrl,您可以通过调用 shell 脚本来使用 wget。
You can you cURL, if it is installed and enabled on the webserver.
Slightly modified example from php.net
When you say
I can hardly believe sending the data in cleartext as a http GET request is safe.
The data will be invisble for the user, but anyone sniffing your data can read it. Does the gateway provide https?
Also sending data using
GET
, opposed toPOST
method is not really safe, since the request url will be visible in the logs, thinking of firewalls and so on. This is of course on the route from your server to the sms gateway.If you SMS Gateway supports it,
POST
+HTTPS
would be the best choice. cURL would also be an ideal choice to use here.In case you dont have cUrl installed, you can use wget, by calling a shell script.
有多种方法可以从 PHP 发出 HTTP 请求。 cURL 是一种流行的方法。
There are numerous ways to make an HTTP request from PHP. cURL is a popular one.
你也可以使用
就是这样。
you can also use
That's it.