我正在尝试发布一个使用SharePoint和PHP的ASPX表单。
发布数据适用于标准表单,我似乎无法使此表单正常工作。我确实注意到提交按钮上有onclick
属性:
onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$PlaceHolderMain$btnSaveTask", "", true, "", "", false, false))"
我从未使用过ASPX,也不知道这是什么。 这不是一个身份验证问题或url的错误,因为它返回网页(包含表单)很好。
这是我的PHP代码:
function add($username, $password){
$data = array(
'ctl00$PlaceHolderSearchArea$ctl01$ctl00' => 'https://keystone.stpeters.sa.edu.au',
'ctl00$PlaceHolderSearchArea$ctl01$ctl04' => '0',
'ctl00$PlaceHolderMain$DateStart$DateStartDate' => '9/05/2012',
'ctl00$PlaceHolderMain$DateDue$DateDueDate' => '10/05/2012',
'ctl00$PlaceHolderMain$Title' => 'test again',
'ctl00$PlaceHolderMain$btnSaveTask' => 'OK',
'__spText1' => '',
'__spText2' => ''
);
$curl_handle = curl_init();
$fullurl = "https://keystone.stpeters.sa.edu.au/_layouts/StPeters.Keystone/MyTasks/MyTaskDetail.aspx?id=0&IsDlg=1"; //
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_URL, $fullurl);
$returned = curl_exec($ch);
curl_close ($ch);
return $returned;
}