Oh, did I actually spend almost an hour on my reply, so I missed the one from Jens?
(05-03-2020, 07:59 PM)Jens Noritzsch Wrote: The first error is due to a Windows madness, the byte order mark (BOM, https://en.wikipedia.org/wiki/Byte_order_mark). IIRC, you could change the encoding in Notepad++ to UTF-8 without BOM.
That makes a lot of sense although I am surprised that the XML parser in Android cannot handle this.
Jens, for the rest of your reply, it seems like we came to the same conclusion.
Julien, it looks to us like you are calling you PHP script separately to check the data submitted by phyphox, but every call to a PHP script is independent from every other call (even on the same machine on the same browser) unless you store the data in a file, a database or something similar. (Again, sorry if we misinterpret this here.)
Thank you very much for your help ! And sorry for all my newbies questions ! php is a total new world for me !
Indeed, may be its too ambitious for me to create this kind of experiment.
Indeed, with UTF-8 encoding it works better !
I can now send the phyphox program to my phone via bluetooth easily. The first error doesn't appears now. The second still appears but only if i store the .phyphox file in my smartphone first and then try to open it. So this problem must comes from the OS of my phone. It's a huawei.
Now, it's clear that phyphox tries to communicate with my laptop.
But i have a new error that appears in the screen of my phone every time phyphox tries to send a value to my laptop :
Network error: Generic error. IOException
May be this problem comes from my server.
I tried to create a new .php file. I only try to store the data in a .txt file.
Here it is :
<?php
$json = file_get_contents('php://input');
$data = json_decode($json, true);
file_put_contents('Doc1.txt', $data)
?>
If so, I am not entirely sure about the error from phyphox - and indeed, this time it is from phyphox. I suspect that this error could be the result of not getting any response from the server. Your PHP script does not generate any output, but phyphox tries to read from the server (I should probably add an option to ignore empty responses). Try to add
First of all, I am not entirely sure if file_put_contents works on an entire object. Please try
PHP Code:
file_put_contents('Doc1.txt', serialize($data));
Still, I am a bit confused about the phyphox error. Can you access logs (error and/or access logs) on your server? If so, please check if an access from phyphox is registered when you try it and whether an error is being logged.
Besides that, I would suggest that you post your current php and phyphox-file, so we can simply test it ourselves.
I think you are right. I uploaded your php file to our server and only adjusted the address in the phpyhox file and it works. I get a Doc1.txt with the following content:
This looks a bit overcomplicated due to the effect of "serialize", but the data is there and phyphox does not show any errors.
At that point I can only recommend checking the address (including the unusual port 6023) and compare it to the address that is working in your webbrowser. Also, since you can reach your server from the webbrowser, you could try a get-version instead of post. Maybe your webserver cannot handle the JSON-POST-Data or does not allow to retrieve it via php://input. Your PHP file then only needs
(05-05-2020, 01:20 PM)Sebastian Staacks Wrote: At that point I can only recommend checking the address (including the unusual port 6023) and compare it to the address that is working in your webbrowser.
@Julien: Does the address work in your mobile's webbrowser? Perhaps there are access restrictions to certain ports on your computer (firewall etc.).
I tried with another device and it works !
If i create a qr code that points to the phyhox program uploaded in my server, i can open the experiment by scanning it with phyphox in a galaxy tab A tablett.
And it works ! The app writes in the Doc1.txt file !
But if i do the same with my huawei phone it doesn't worfk. When i scan the qr code with phyphox i have this error
Error loading exerient from phyphox: Cleartext HTTP traffic to 192.168.1.5 not permitted
Jepp, that's a common one on newer devices. Google quite aggressively fights insecure communication on the web and prevents apps from using unencrypted communication unless they explicitly allow this. So, since Android 8 (I think) you get this error if you try to read a configuration via a plain http connection. Can you simply enable https on your server? That should solve the problem.