hyperlog-android icon indicating copy to clipboard operation
hyperlog-android copied to clipboard

Get the file using PHP

Open pdivita opened this issue 7 years ago • 3 comments

Hi, I'm pushing the logs on beeceptor.com (since request.bin is closed). Logs are displayed correctly, and also the header, so the pushing is OK. I'm trying to send log to our php webserver, but I don't know how to access the filename. $_POST is empty, $_FILES is empty, file_get_contents('php://input') is empty too. I can display the headers(in this example i changed the filename to 'gigi'):

App-Id: it.test.app
User-Agent: it.therocks.merchandiser (Android 6.0)
Device-Id: 4ae8e6217abba451
If-Modified-Since: Mon, 23 Apr 2018 17:05:12 GMT+00:00
Content-Disposition: attachment; filename=gigi
Device-Time: 2018-04-23T17:11:58.524Z
Content-Type: multipart/form-data;boundary=HyperLog -1524503518517
Host: acer.therocks.it
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 1049

So my question is: how can I get the content of the logs?

Thanks

pdivita avatar Apr 23 '18 17:04 pdivita

I found a solution by myself. As mentioned here 'php://input' is not available with enctype="multipart/form-data" (which is the one used by the function pushLogs). This is a bit frustating, as it seems there is no way to get the body content in PHP.

I solved by dumping the log in a file (using getDeviceLogsInFile) and sending it with a standard post.

pdivita avatar Apr 24 '18 11:04 pdivita

Hi pdivita,

I had the same problem and fixed it by setting enable_post_data_reading = Off in php.ini Kudos goes to https://stackoverflow.com/a/19710850/8186422.

Cheers

jdckr avatar Jun 30 '18 06:06 jdckr

Having the same issue, where my server is a java spring boot project.

Now I'm using the solution @pdivita suggested. To get the log file and send it to the server using a standard request.

Any suggestions for this.

ismdcf avatar Apr 09 '21 20:04 ismdcf