我正在使用 Goutte,https://github.com/fabpot/goutte,并有以下代码,
$client = new Client();
$crawler = $client->request('GET', \Config::get('Eload2::url'));
$form = $crawler->selectButton('Submit')->form();
// add extra fields here
$client->submit($form);
如何在提交之前将隐藏的输入字段添加到表单中?
我尝试了以下代码,
$domdocument = new \DOMDocument;
$formfield = new InputFormField ($domdocument->createElement('__EVENTTARGET', 'ctl00$ContentPlaceHolder1$DDLTelco'));
$formfield2 = new InputFormField ($domdocument->createElement('__EVENTARGUMENT',''));
$form->set($formfield);
$form->set($formfield2);
但返回以下错误信息,
InputFormField 只能从输入或按钮标签(给定 __EVENTTARGET)创建。