To connect local php website, i was able to connect from another pc in the same network by using ipaddress/foldername (eg. 192.168.1.1/test). I want to know that can i connect from android phone in the same wifi using the same method.
You could also use ngrok for this:
https://ngrok.com/
ngrok allows you to create a globally accessible domain name which directs to your local pc, especially useful for development.
As your device in the same local network, it will connect to your local website on your way
Related
I made an ionic app with a connection to MYSQL using a PHP API which I put on another computer on Xampp, using it as a remote server in the same network, when I run it on the computer with ionic serve , it works fine but when I generate the APK, it wont connect to the BD, even tho Im on the same network, does someone knows any way around this?
this is how it looks on the desktop
and this is how it looks on the cellphone
What I would conclude is that it connects to the nodejs server ("ionic serve") to load the assets from there but it cannot load data from the php/mysql API.
How did you reach the conclusion that MySQL is the problem? I mean your frontend (angular) does connect directly to MySQL right?
Hint: check your settings within ionic when you call the API -- it should point NOT to localhost/127.0.0.1 but to your computer's network IP. Apache should also be "open" to connections from "outside":
see here: Accessing localhost (xampp) from another computer over LAN network - how to?
I had the same problem in the past, it is because when you run the application on your pc it is working on localhost, just like your backend. When you run your application on a mobile device, it does not have access to your pc using localhost to access the backend.
In this case you must set the IP that your pc has on your local network as the backend address and in this way your mobile application can access it
I have a MacBook and I am currently working on a web-app for our school. I am using PHP, MySQL, and Apache, all provided through the XAMMP stack.
When testing the website via localhost it works fine. Now, some of my teachers wanted to try out the web-app via their phones. Can I configure my MacBook to work like some sort of a 'local server' (e.g. probably through the internal network) to which other devices on the same internal network can connect via their phone browsers?
Is this possible?
You need to understand in using a Website, the client itself doesn't need to contact the database server. The web server is the one who communicate with database server and send/serve html pages to the client.
Phpmyadmin is a website not a database itself. So you simply need to allow access to your web server,you can use your laptop as web server. Test directly using your laptop as a web server, open the website instead using localhost change it to your laptop ip address. If it's not working then tell us the error so we can help you from there.
Android app Connectivity with Local Web Server
I want to connect my android app with local web server to access my php files and store data into web server database.
I also tried to use free hosting web site 000webhost.com but their database didn't provide me InnoDB DB engine, They have MYISAM which doesn't provide foreign key property...
please suggest me any solution for this issue...??
1、you can connect to you local web server through 127.0.0.1/yourproject/path
2、check you ip, like 192.168.0.110 etc.
3、try to access 192.168.0.110/youproject/path in your phone browser.
if you can access in you browser, that's your testing address
If using windows get your server ip by running:
ipconfig
in the Command Prompt. Then search for IPv4 that is your server ip;
If Using Linux Use:
ifconfig
in terminal. Then get inet addr field in wlan0.
Now you have ip address of server.
Use it as: http://yourserveripadress
I am developing an application which basically starts with registration system using the wampserver to connect to mysql database through localhost/phpmyadmin as a back-end and android client using genymotion emulator as a front-end and both front and back end communicates through php/mysql API.
I have followed different tutorials to achieve all this but since none of them actually used genymotion I am missing the part of which IP, I should put for this mechanism to follow smoothly.
when you use emulator on you pc , your emulator will connect to virtual network interface that you can change it ....
you should check emulator network interface and enter your pc ip in that network interface ...
i attached a picture of setting of my emulator and you can see my emulator use my wifi network interface .... thus i should insert my computer ip address of wifi network interface
finally you should get your pc ip as network interface that your emulator connected to that and use that ip in emulator for connect to your webserver in your pc.....
in Wampserver, you can not access to apache from outside ...
you should change apache config (httpd.conf) and make access for outside connection ...
how can i connect an android app (on my phone) to a php server (EasyPHP) that i am running on my machine (localhost). Are there any tutorials out there that document this.
I need to test the app on an actual phone not an emulator (because the emulator contains bugs for certain activities). Any help would be great!
If you connect on your Android with WiFi, you will be in the same network, then you can access PHP server via your machine's IP address.
Ys you connect to the php script...
Android allows you to sent data in GET and POST method..
I found a useful tutorials about this: Android phpMysql connection