将数据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 关注
- 700 浏览
添加回答
举报
0/150
提交
取消
