Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the file using PHP #10

Open
pdivita opened this issue Apr 23, 2018 · 3 comments
Open

Get the file using PHP #10

pdivita opened this issue Apr 23, 2018 · 3 comments

Comments

@pdivita
Copy link

pdivita commented Apr 23, 2018

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
Copy link
Author

pdivita commented Apr 24, 2018

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.

@jdckr
Copy link

jdckr commented Jun 30, 2018

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

@ismdcf
Copy link

ismdcf commented Apr 9, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants