Hi
I am attempting to access a MySQL database from Unity using the UnityWebRequest class.
The order of connection would be UnityWebRequest>>a PHP file>>MySql database.
The database is set up with the MySQL workbench application, and a VS script is running to enable a UI and data access through a port. This is basically a web-browser based manipulation interface for the database and it should be independent from the Unity access.
The whole thing is running on localhost with a local folder as root.
From Unity I am trying to access a .php file I placed in the localhost’s folder system.
I have tested the path and the access with a simple .txt file and a .html file too and I can access them without a problem, however when trying to access the .php I get a not found error. It is 100% sure that the filename and path is correct.
I am using the following code :
UnityWebRequest r = UnityWebRequest.Get("http://localhost:50693/.php/webtest.php");
yield return r.SendWebRequest();
if (r.isNetworkError || r.isHttpError)
{
Debug.LogError(r.error);
}
else
{
Debug.LogError(r.downloadHandler.text);
}
and the result is :
HTTP/1.1 404 Not Found
When I am using the same code with the same path except for the filename as test.txt or test.html, I am getting the correct contents of the files.
Any idea what could be the problem?