简体   繁体   English

从没有互联网的Android应用程序与PHP进行通讯?

[英]Communicating with PHP from an android app without internet?

I have made a web page and i am running it on a local host using the xampp server. 我已经制作了一个网页,并且正在使用xampp服务器在本地主机上运行它。 In this web page I have a canvas that draws a line between two point. 在此网页中,我有一个画布可以在两点之间画一条线。 I read these points from a locally available csv file that I have generated. 我从生成的本地csv文件中读取了这些要点。 I would like to make an android application, where there is a provision to enter two numbers. 我想制作一个android应用程序,其中可以输入两个数字。 I want this android application to make a csv file and save it on my computer so that I can access this file using my javascript. 我希望这个android应用程序制作一个csv文件并将其保存在我的计算机上,以便我可以使用我的JavaScript访问此文件。

Note: can I pass these values via an usb connected between the mobile and computer so that I can make a csv file locally in my computer? 注意:我可以通过连接在移动设备和计算机之间的USB传递这些值,以便可以在计算机本地创建一个CSV文件吗? I want all of this to happen without the requirement of internet connection. 我希望所有这些都可以在不需要互联网连接的情况发生

PS: I am newbie to android. PS:我是android的新手。 If the above is possible, then please brief on how to approach this problem. 如果上述情况可行,请简要介绍如何解决此问题。

If you have a XAMP server all you need to do is connect the android device to the same network/router. 如果您有XAMP服务器,则只需将android设备连接到同一网络/路由器即可。 There you can talk via HTTP methods to the apache server. 在那里,您可以通过HTTP方法与apache服务器对话。 You will just need to provide the ip address to the android app. 您只需要提供android应用程序的IP地址即可。

In the router you can set a static ip address for the mac address of your computer, so every time it connects to the router it always get the same IP and you dont need to input it again on the android app. 在路由器中,您可以为计算机的mac地址设置一个静态ip地址,因此每次它连接到路由器时,它始终会获得相同的IP,因此您无需在android应用中再次输入该IP。

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

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