How to post data in PHP using file_get_contents?

I’m using PHP’s function file_get_contents() to fetch contents of a URL and then I process headers through the variable $http_response_header.

Now the problem is that some of the URLs need some data to be posted to the URL (for example, login pages).

How do I do that?

I realize using stream_context I may be able to do that but I am not entirely clear.

Thanks.

3 Answers
3

Leave a Comment