Curl --binary-data php not working properly with php://input

dtect.000.pe

(please specify the URL of the site on which you are experiencing the problem)

No error message visible.
Problem: php is not processing “php://input” properly.
Data should be available there, when uploaded with “Content-Type: application/binary; video/; audio/
With curl, binary data can be uploaded like this:

curl \
   -X POST\
   -H 'Content-Type: application/data; audio/*; video/*; audio/wav' \
  --data-binary     @'audios/amlo1.wav' \
  --url 'http://mysite.com/receive.php'

** substitute [http://mysite.com] with your web-site
====================
@audios/amlo1.wav, is local file, in folder "audios", relative to the current directory for curl.  
====================
receive.php:  takes care of moving/copying the contents in "php://input" to a normal file inside your web-site
====================

This works well when testing php in localhost, with php server.

With Infinityfree php server , does not work at all.

Please notice that this uploading mode is different than uploading with a [html form].

This curl “upload” is not a “multipart/form-data” post request.

( If your answer is to use “multipart/form-data”, please do not write your answer. It is not correct )

This command in curl, allows to upload raw data, without giving the local “file-name”.

Using this curl command, $_FILES does not show any info. All data has to be obtained from “php://input”, and moved or copied to another folder with php.

I need this working properly, because another web-site will be sending my web-site, json data this way. I cannot change the way the other web-site works.

Infinity’s side is not working properly when this kind of upload is taking place. Please fix, if possible for you.
Again, this is not a post request from a “html-form”.

If anyone knows how to receive “php://input” properly in Infinityfree, please let me know.

Thank you very much.

See

curl and similar cli tools just won’t work here.

5 Likes

Sorry, in the title it should be “php://input” (not php://info)

Does php://input work with VPS ?

You control the VPS so of course it will work.

Premium hosting should also work, but on free hosting, no.

Another workaround is to purchase a domain and use cloudflare with it.

4 Likes

Thank you so much !!! Response faster than speed-of-light !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.