file_get_contents
is not that hard, actually : as you guessed, you have to use the $context
parametresini kullanarak bir HTTP POST isteği gönderiliyor.
There's an example given in the PHP manual, at this page : HTTP context options (quoting) :
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);
Temelde, doğru seçenekler (there is a full list on that page) ile, bir akışı oluşturmak, ve file_get_contents
üçüncü parametre olarak kullanmak için var - daha fazla şey ;-)
As a sidenote : generally speaking, to send HTTP POST requests, we tend to use curl, which provides a lot of options an all -- but streams are one of the nice things of PHP that nobody knows about... too bad...