I was trying to get some data from webside, here is the code
var url = "http://mshl.cba.pl/1.php";
var res = " ";
function Start() {
getress();
}
function getress() {
var wwwResponse = new WWW(url);
yield wwwResponse;
res=(wwwResponse.text);
}
here is the webside, CBA
as you can see there is “hello”
but my script is giving me whole website code in html to res variable
what is wrong??
thats html, not php.
php files have a php extension. I dont think you can embed php code in a standard html file, but im not a web-monkey, so dont quote me on that.
Ok, so i changed this to php
php code is here
<?php
echo ("hello");
?>
but still this same problem
the file is a php file on your server right?
Whell, its pretty simillar code, my is just smaller
i read there only about this crossdomain.xml but it didn’t help too
i changed code to this
var url = "";
var res = "";
function Start() {
getress();
}
function getress() {
var www = new WWW(url);
yield www;
//res = www.text;
gameObject.guiText.text = www.text;
}
but it still doesn’t work
http://mshl.cba.pl/1.html
(“hello” is string that i want to get)
I note in your php you have echo (“hello”)
in the samples, they are:
echo ‘
An error has ocurred.
’;
try updating to match (using ’ rather than ")
Unfortunately it doesn’t work too ;/
I have found this : WWW.text is returning entire index.php page - Questions & Answers - Unity Discussions
guy there sad :“Exactly, if the whole or parts of a php script arrives on the client side it’s a very faulty PHP script or a wrong configured webserver.”
tomorrow i will try another webserver
thanks for aswers
No, it doesn;t work, is there any other way to download data from mysql server?
EDIT: I forgot about this topic, but i founded solution, i just changed my DataBase Host, and it is working as it should, thanks for help