將數據POST到PHP中的URL如何將POST數據發送到PHP中的URL(沒有表單)?我將使用它來發送變量來完成并提交表單。
3 回答

慕萊塢森
TA貢獻1810條經驗 獲得超4個贊
你可以在php5中使用cURL-less
$url = 'URL';$data = array('field1' => 'value', 'field2' => 'value');$options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ));$context = stream_context_create($options);$result = file_get_contents($url, false, $context);var_dump($result);
- 3 回答
- 0 關注
- 679 瀏覽
添加回答
舉報
0/150
提交
取消