This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Server for live experiment
#11
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.)
Reply
#12
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)
?>
Reply
#13
So, you see data from phyphox in your Doc1.txt?

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
PHP Code:
echo "{}"
at the end of your script to see if it goes away.
Reply
#14
No, unfortunatly no data are written in the Doc1.txt file.
I add echo "{}"; to my code but there has been no improvement.
Reply
#15
Then I was a step too far ahead.

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.
Reply
#16
Here are the files.

I have just checked the logs and i saw nothing from phyphox...So i assume the error comes from the serveur...


Attached Files
.phyphox   live test.phyphox (Size: 1.21 KB / Downloads: 353)
.php   live.php (Size: 153 bytes / Downloads: 355)
Reply
#17
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:
Code:
a:1:{s:3:"abs";a:9:{i:0;d:9.801656071801983;i:1;d:9.804489695813183;i:2;d:9.802379780988671;i:3;d:9.798851544620522;i:4;d:9.796296726966633;i:5;d:9.689141813263785;i:6;d:9.793424027695528;i:7;d:9.794612350747274;i:8;d:9.792605530363533;}}

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
PHP Code:
file_put_contents('Doc1.txt'serialize($_GET)); 
without the two preceding lines.
Reply
#18
(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.).
Reply
#19
I have made some progress !

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

So the probem comes from my phone.
Reply
#20
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.
Reply


Forum Jump: