Slim framework not working on mobile - SOLVED

I am new to slim. Everything works fine in my Qt app on windows, such as connection to host and routes, but as soon as i deploy the app to android i get:

QNetworkReply::NetworkError(HostNotFoundError)

But whilst still in android In the same app I can get a reply from “http://google.com”, but not “http://test/api/fruit”-which works on windows. I have only been using slim for a few weeks now and it’s great, but I have no idea what to do here. Thanks

Hmmh, have you tried accessing the said URL from the android device browser?

Hi

Yes I’ve tried that, I get an error:

test’s server DNS address could not be found.

ERR_NAME_NOT_RESOLVED

Seems the error is not really Slim related, the issue I suspect is name resolution, the reason this may be working on Windows is because the hosts file contains the domain in question. Just a hunch.

Ok thanks but what should I do now to fix this? I assume this would be related to android device? would it be anything to do with the androidmanifest file?

Am not to sure how to fix the issue on android, what I would try is to use an IP address if the name resolution can’t work

I tried in android browser:

my computer ip address/api/fruit

still no luck but thanks anyway

What happens if you just put a plain HTML page in:
my computer ip address/api/fruit
does it show something?

Just trying to check the first obvious thing :wink:

Hi I think I know what I’ve not done, and that should solve it, If I’m right it has nothing to do with Slim… I will try and sort it out.

thanks

If you solve it, please put your solution inhere too, so it can help people in the future…

Hi unfortunately I still have not got it working…

I thought it was because I had not enabled my wamp server for remote access for all devices on my lan. After many posts it seems that as my wampserver is 3.0.6 (latest version) it should have been a case of editing my added virtual host for the slim api server in httpd-vhosts.conf. Something like:

<VirtualHost *:80>
    ServerName test
    DocumentRoot c:/wamp64/www/test/public
    <Directory  "c:/wamp64/www/test/public">
	    Options +Indexes +Includes +FollowSymLinks +MultiViews
	    AllowOverride All
	    Require all granted        <-- changing this from require local
                Require ip 192.168.1      <-- adding this for all devices
    </Directory>
</VirtualHost> 

But after restarting server and typing in browser:

pc ip/test/fruit

I now get forbiden… dont have permission

but if I ‘require grant all’ to the wamp’s default virtual host, and put pc ip in android browser I can access the wamp page-- but this is not what I want

The thing is, that you have to figure out if it has anything to do with Slim, or it’s just a server-config that is bothering you.
I use laragon (also a kind of wamp thing, and runs great) with nginx these days. Perhaps something to try out?.

Hi

After days of battling with the issue, I had a similar idea and moved over to xampp, and within a few moments the problem was solved! I’m sorry for wasting your time as it had nothing to do with Slim. Slim is great :smile:

Thanks again