我这里有一个aspx页面。该页面有一个带有发布操作的表单:
<form name="form1" method="post" action="Average1_web.aspx" id="form1">
提交表单后的结果本身是一个 aspx 页面 ( Report_For_mthly_avg_Zonewise.aspx
)。
我需要从结果页面中抓取表单输入的所有排列和组合的数据。有什么方法可以在 php 字符串而不是页面中获取 post 方法的结果(Report_For_mthly_avg_Zonewise.aspx
)?
谢谢
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "yourform.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('field1' => 'val1','field2' => 'val2','field3' => 'val3','field4' => 'val4'));
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
提交后,$result将保存表单登陆页面的 html 代码......所以你要抓取的页面。