- Home /
PHP Android WWW Unknown Error
So I am getting issues with my login/registration system when deploying to Android. If I run it in Unity it works just fine. But when I run it in Android I keep getting Unknown Error when submitting POST requests to my PHP back-end. This is coming from parsing www.error. www.text comes back empty. So I simplified the code to test, and I STILL get Unknown Error even with this super simple code. Any ideas?
Clickme.cs
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class Clickme : MonoBehaviour
{
public Text Result;
public void OnClick()
{
StartCoroutine(RunScript());
}
IEnumerator RunScript()
{
WWW www = new WWW("http://www.familypolaris.com/helloWorld.php");
yield return www;
if (www.text == "")
Result.text = "Result was empty, error: " + www.error;
else
Result.text = www.text;
}
}
helloWorld.php
<?php
echo "Hello World!";
?>
i can't see any problem. Can you access that php through web browser?
Web browser works just fine and somebody else tried the code on their own device and it works fine. It sounds like it may be a build issue.
Answer by BlueSin · Aug 23, 2018 at 04:04 AM
I figured it out, so I will post the answer here. After somebody commented that they tried my code and it worked just fine, I decided to try another device here. That device also failed to register and login. This told me something was wrong with my build settings. My first idea was to switch build type from Gradle to Internal, and that solved the problem for both my devices immediately.
Your answer
Follow this Question
Related Questions
Live chat using MySQL? 0 Answers
Scene Management not working from a WWW.text value 0 Answers
Add multiple mySQL items at once? 1 Answer
Android build, wwwform gives ssl.SSLHandshakeException 1 Answer
Remember currently logged in player 1 Answer