Write on a NFC tag using simple php form

独自空忆成欢 提交于 2019-12-31 05:34:14

问题


I'm using NFC for the first time, I have to write a simple php form with some data (id, name, qty, etc) and store these values on an NFC tag (I would use GET or POST methods).

How can I store these data on an NFC tag? I have a GoToTags device to store information in a NFC tags, but I don't think I can use it to store my "custom" values.


回答1:


A PHP web application's code is executed on the server side, so if you want to interact with hardware (NFC reader, NFC tag) on the client side, you will need to use something else besides PHP code to access that client side hardware.

The client-side NFC reader would typically not act as a web server and therefore won't be accessible through HTTP GET/POST requests (see the exception below), so you will have to find something else.

Your web application will also consist of a web page (HTML, CSS, (Java) script) that is displayed and executed on the client side. This web page could, for instance, contain script code that is executed within the client web browser.

  • As GeraldSchneider commented, there is the NFC Web API, but this is not yet available in most (any?) web browsers.

  • An alternative could be a Java applet embedded into the web page. If the NFC reader is PC/SC compliant, you could, for instance, use the Java smartcardio API within that applet to access the reader.

  • Yet another possibility would be to create a browser plug-in that supports communication between your web page and the NFC device.

  • If you really want/need to use HTTP GET/POST requests, you could provide a client-side application that acts as a web server and processes your GET/POST requests. That client-side application would then access the NFC reader/NFC tag based on these requests. However, besides the PHP web application/the web page you would also need to provide that separate client application and the application needs to run on the client while your web page is accessed.



来源:https://stackoverflow.com/questions/22252440/write-on-a-nfc-tag-using-simple-php-form

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!