使用HttpClient时如何保护我的PHP Web服务? [英] How to secure my PHP web service when using with HttpClient?

查看:80
本文介绍了使用HttpClient时如何保护我的PHP Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP网络服务,我正在使用HttpClient来获取和发布

I have a PHP web service and I am using HttpClient to get and post

我想知道如何我可以保护它吗?

I want to know how can I secure it?

因为现在,任何人都可以致电http://www.domain.com/ws/getallmembers.php,他们会得到所有成员,所以我怎么能确定只有经过授权的人才能得到这个吗?

because right now, anyone can call http://www.domain.com/ws/getallmembers.php and they will get all members so how can I make sure only authorized people can get that?

请指导..

谢谢,

Jassim

推荐答案

使用您的Web服务器提供的身份验证机制,或创建一个成功登录时生成令牌的Web服务,然后要求在每个请求上传递令牌或使其失败。

Either use authentication mechanism offered by your web server, or create a webservice that generates a token on successful logon, then requires the token be passed on each request or fail it.

当然,保护网络服务需要做的第一件事就是用HTTPS保护它。

Of course, the first thing you'll need to do to secure the webservice is to protect it with HTTPS.


这篇关于使用HttpClient时如何保护我的PHP Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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