UnityWebRequest returns an empty string

Version: 2019.3.11f1

I tried to add a simple online leaderboard to my game. I created a SQL database and wrote a PHP script which accesses it. So far so good.


The PHP script’s URL is the following:
https://starcaders.com/leaderboard.php


As you can see, the PHP script is working and displays the table’s entries (only two test entries atm). My goal is to read the text on the page and save it as a string in Unity.


Unfortunately, the code below returns an empty string.
The isDone bool is also false.


I also tried to add a “SendWebRequest()” after yield return leaderboard, but that leads to the following error message:
Curl error 51: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_EXPIRED
and also returns “hahaha TEST 123”, my placeholder string.


I also tried to retrieve text from other sites, but that returns an empty string as well.
At this point, I am basically completely at a loss, which is why I created this thread.


Thank you for your time, below you can see my code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine.Networking; // for UnityWebRequest

public class Leaderboard : MonoBehaviour
{
    void Start()
    {
        StartCoroutine("RequestLeaderboard");
    }

    IEnumerator RequestLeaderboard()
    {
        UnityWebRequest leaderboard = UnityWebRequest.Get("http://starcaders.com/leaderboard.php"); //sends http request --> php script reads sql database
        yield return leaderboard; //waits until request is done
        string leaderboardString = "hahaha TEST 123";
        if(!leaderboard.isNetworkError && !leaderboard.isHttpError)
        {
            leaderboardString = leaderboard.downloadHandler.text;
        }

        Debug.Log(leaderboardString);
    }
}

EDIT: I updated to Version 2020.1.3f1, the problem is still the same