I can’t wrap my head around using UnityWebRequest to call .php files in my database.
I have created an AWS S3 bucket and uploaded 2 files:
hello.php
hello.txt
hi there
I am able to access the .php file using this code:
private void Start()
{
StartCoroutine(Get(URL));
}
private IEnumerator Get(string URL)
{
UnityWebRequest _request = UnityWebRequest.Get(URL);
yield return _request.SendWebRequest();
if (_request.isNetworkError || _request.isHttpError)
Debug.LogError(_request.error);
else
{
string _text = _request.downloadHandler.text;
print(_text);
}
}
But the log message that is being printed to the console looks like this:

The entire text inside the .php file is being returned.
I tried changing the .php to this:
<?php
echo "hi there";
?>
But the result is exactly the same.
Does anyone know what I’m doing wrong?