Im trying to acced to a database via PHP
i have seen post that i have to call the PHP file via WWW
im doing this:
IEnumerator llama_php(){
string textodd="";
string url="file:///C:/xampp/htdocs/webservice/conexion_juan.php?f=utf8_converter";
using (WWW www = new WWW(url))
{
yield return www;
textodd=""+www.text;
Debug.Log("descargando...");
}
utf8_converter is the function on PHP that i need to call
this is the php file
<?php
class conexion{
public function conectar(){
$hostname = 'localhost';
$database = 'prueba_uno';
$username = 'root';
$password = 'password';
$mysqli = new mysqli($hostname, $username,$password, $database);
if($mysqli -> connect_errno){
die( "Fallo la conexión a MySQL: (" .$mysqli -> mysqli_connect_errno(). ") " . $mysqli -> mysqli_connect_error());
return false;
}
else{
return $mysqli;
}
}
#Este metodo devuelve recibe un arreglo y lo codifica en utf8 para no causar problemas en json
function utf8_converter($array){
array_walk_recursive($array, function(&$item, $key){
if(!mb_detect_encoding($item, 'utf-8', true)){
$item = utf8_encode($item);
}
});
return $array;
}
}
?>
but instead of give m the array, or a string with only the db array, it returns me the whole code in an string
“<?php
class conexion{…”
can you help me please?