简体   繁体   English

是否可以在PHP中为Restlet创建客户端?

[英]Is it possible to create a client in PHP for Restlet?

Im developing a java application that provides some methods using restlet to a android app. 我正在开发一个Java应用程序,该应用程序提供了一些使用restlet的方法到android应用程序。

I created the server and the client using this tutorial (GAE server and Android client) 我使用本教程创建了服务器和客户端(GAE服务器和Android客户端)

Now I need to make a PHP client that is able to access that data. 现在,我需要制作一个能够访问该数据的PHP客户端。 Is that possible? 那可能吗? What is the best way to do it? 最好的方法是什么?

I already tried to get the data using Advanced REST client but restlet always provide a 404 error 我已经尝试使用高级REST客户端获取数据,但restlet始终会提供404错误

Edit: I can use any web language, PHP was used as an example 编辑:我可以使用任何网络语言,以PHP为例

I ended up using a restlet extension 我最终使用了restlet扩展名

I hope it helps somebody else ;) 我希望它可以帮助其他人;)

Restlet provides a way to implement RESTful applications. Restlet提供了一种实现RESTful应用程序的方法。 They are independent from the client so you should be able to consume them with any language. 它们独立于客户端,因此您应该可以使用任何语言来使用它们。

I would recommend you to enable traces on the server side to find out what happens: 我建议您在服务器端启用跟踪,以了解发生了什么:

Engine.setLogLevel(Level.FINEST);

You can try to use curl to have a low-level view of exchanged messages (address / path, headers and payload). 您可以尝试使用curl来获得交换消息的低级视图(地址/路径,标头和有效负载)。

Hope it helps you, Thierry 希望对您有帮助,蒂埃里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM