Https GET request?

The fact is that I have my own server with the HTTPS protocol and, despite this, data is not loaded from the server to mobile devices.

I will be very grateful if you try to connect using mobile devices
And if you manage to connect, write to me, thanks!
https://server.marandici.de/server.php

Well I’ve tried in Chrome on iPhone XR and says server ok!

With my mobile phone (Android 10) I logged into the site and the message “server ok” appears.

Thank you, game chat should work on mobile devices!
But unfortunately I haven’t solved this problem yet :frowning:

Check the CORS in your server maybe in your .htaccess you can add some rules to allow request from any origin.
Some samples

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"

I was a little ago wrapping my mind to allow this on mobile devices and that solve my problem

1 Like
<?php

header(“Access-Control-Allow-Origin: *”);
header(“Access-Control-Allow-Headers”, “origin, x-requested-with, content-type”);
header(“Access-Control-Allow-Methods”, “PUT, GET, POST, DELETE, OPTIONS”);

$hostname = ‘************’;

$username = ‘*********’;

$password = ‘*********’;

$database = ‘********’;

$link = mysqli_connect($hostname, $username, $password, $database)
or die("error " . mysqli_error($link));

$query = "SELECT * FROM users ORDER BY id DESC LIMIT 15";

$result = mysqli_query($link, $query) or die(“error” . mysqli_error($link));

while ($row = mysqli_fetch_array($result)) {
echo (" “.$row[‘message’] .” \n “.$row[‘date_time’] .”\n" ."\n" );
}

mysqli_close($link);

?>

:white_check_mark: Works on all devices !!! :white_check_mark:

I tested the project with your URL on Android and it looks like a CORS problem. Add entries in .htaccess as provided by UlisesFreitas.
You can read what CORS is here:

1 Like

This is important too in your PHP file above all add

header(“Access-Control-Allow-Origin: *”);

And this other line to match your server timezone

date_default_timezone_set(‘Europe/Madrid’);

1 Like

:white_check_mark: Problem solved thanks to everyone who participated!
Source code above!