我需要读取使用 POST 操作类型提交的表单的结果。那么,我是否可以将通过 GET 变量获得的变量转换为 POST,然后我可以使用 file_get_contents() 简单地读取内容。
请帮助我使用此方法或通过某种替代方法(如果可能)获取数据。
文件获取内容可用于执行 POST 请求流上下文创建:
$options = array('http'=>array(
'method'=>'POST',
'header'=>'Content-type: application/x-www-form-urlencoded',
'content'=>'var1=a&var2=b'
)
);
echo file_get_contents('http://somesite.com/someform/', false, stream_context_create($options));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)