开发者

Yii Framework, JSON API, Restricted by URL

I am trying to build an API service for my Yii based website,

I have crea开发者_开发知识库te an API controller with all the functions that returns objects in JSON format.

I also created a system to generate API keys for a specific URL... but I cant seem to understand how to detect the url from where the call is being made to my api so I can compare and validate.

I have tryed with HTTP_REFERER ...not working...

Any idea how is this possible ?

Thanks


try this:

Yii::app()->request->urlReferrer

or

Yii::app()->request->host

or

Yii::app()->request->hostAddress

for more details see http://www.yiiframework.com/doc/api/1.1/CHttpRequest

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜