Goutte无法提交表格

时间:2018-10-29 18:53:38

标签: php goutte

我遇到了问题。我正在尝试用goutte提交表格。但是它不起作用。 这是网站网址https://www.petakids.com/spotlight/free-peta-kids-stickers/

这是我的代码

        $crawler = Goutte::request('GET', 'https://www.petakids.com/spotlight/free-peta-kids-stickers/');
        $form = $crawler->selectButton('btnSubmit')->form();
        $crawler = Goutte::submit($form,array(
            'strFName' => 'sayed',
            'strLName' => 'sayed',
            'strCompanyName' => 'sayed',
            'strAddr1' => 'sayed',
            'strCity' => 'sayed',
            'strState187' => 'AK',
            'strEmail' => 'reovilsayed@gmail.com',
            'strCountry' => 'Albania',
            'strZip' => 'sayed',
            'strPhone' => 1926184022,
        )); 

1 个答案:

答案 0 :(得分:0)

尝试一下:

$crawler = $client->request('GET', 'https://www.petakids.com/spotlight/free-peta-kids-stickers/');
$form = $crawler->filter('#PETAKidsFreeStickers')->first()->form();

$crawler = $client->submit($form, array(
    'strFName' => 'sayed',
    'strLName' => 'sayed',
    'strCompanyName' => 'sayed',
    'strAddr1' => 'sayed',
    'strCity' => 'sayed',
    'strState' => 'AE',
    'strEmail' => 'reovilsayed@gmail.com',
    'strCountry' => 'Albania',
    'strStateOther' => 'NONE',
    'strZip' => '8440732',
    'strPhone' => 1926184022,
));

问候