像這樣:
// Create map with request parameters
$params = array ('surname' => 'Filip', 'lastname' => 'Czaja');
// Build Http query using params
$query = http_build_query ($params);
// Create Http context details
$contextData = array (
'method' => 'POST',
'header' => "Connection: close\r\n".
"Content-Length: ".strlen($query)."\r\n",
'content'=> $query);
// Create context resource for our request
$context = stream_context_create (array ('http' => $contextData));
// Read page rendered as result of your POST request
$result = file_get_contents (
'http://www.sample-post-page.com', // page url
false,
$context);
// Server response is now stored in $result variable so you can process it
來源: http://fczaja.blogspot.ch/2011/07/php-how-to-send-post-request-with.html
你怎麼樣使用捲曲? – Ibu
詢問前請先搜索。有[很多很多問題](http://stackoverflow.com/search?q=%5Bphp%5D+post+to+url)直接回答這個問題。 –
有沒有一個圖書館真的爲我抽象呢? cURL看起來像是矯枉過正。 – sergserg