I did some research on this topic, and there are some experts who have said that it is not possible, so I would like to ask for an alternative solution.
My situation
I faced similar issues with POST Request where GET Request was working fine on my backend which i am passing my variables etc. The problem lies in there that the backend does a lot of redirects, which didnt work with fopen or the php header methods.
So the only way i got it working was to put a hidden form and push over the values with a POST submit when the page is loaded.
echo
'
';