r/PHPhelp • • Sep 04 '25

problem file_get_contents("php://input", true) that does not read any data if / does not end url

Hello,

I created an api rest and i manage to retrieve data with

file_get_contents("php://input", true)
If I call the api with postman with / at the end of url it works well.
But if I do not put the / at the end of the url, file_get_contents("php://input", true) does not get any data.

Does anyone know how I could solve this problem ?

Many many thanks in advance.
4 Upvotes

31 comments sorted by

View all comments

Show parent comment

1

u/Double-Bed313 Sep 04 '25

I really do appreciate your help, this is chineese to me but i'm looking that you sent me.
For now my htacess is like below and it's still does not work

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
DirectorySlash Off