I would like to add some data to the body of a http request using cURL in PHP.
Is this possible? How?
I’m sending a HTTP request to a remote server. I have added all the headers I want, but now I need to add some more data to the HTTP body but I cant figure out how to do it.
It is supposed to look something like this:
Host: stackoverflow.com Authorization: Basic asd3sd6878sdf6svg87fS User-Agent: My user agent ... other headers... I want to add data to the request here
Not 100% sure what you mean…
If you want to grab a page, and replace the content/insert some content to it – you could do something like this:
This would print this page…
EDIT:
With the new information added, I do think you should be able to use the POSTFIELDS.. Just remember to set the POST to 1..
E.g. (something like this – not tested)