1
在Amazon Create Wish List Link其中彈出窗體。表格中包含以下方式提交按鈕:Goutte:如何提交沒有價值的表單按鈕?
<span class="a-button-inner"><input data-action="reg-create-submit" data-reg-create-submit="{"sid":"192-7611799-5529931"}" class="a-button-input a-declarative" type="submit" aria-labelledby="a-autoid-162-announce"><span class="a-button-text" aria-hidden="true" id="a-autoid-162-announce">
Create a Wish List
</span></span>
我使用下面的代碼,但它不取形式:
require_once 'goutte.phar';
error_reporting(E_ALL);
use Goutte\Client;
$crawler = $client->request('GET',$url);
$status_code = $client->getResponse()->getStatus();
$form = $crawler->selectButton('Sign in')->form();
$crawler = $client->submit($form, array('email' => '[email protected]', 'password' => 'amazonpasswd'));
//Create a Wish List
$crawler = $client->request('GET',"http://www.amazon.com/gp/registry/wishlist/ref=nav_wishlist_create?ie=UTF8&triggerElementID=createList");
sleep(5);
$form = $crawler->selectButton('
Create a Wish List
')->form();
print_r($form); //It returns Nothing
的問題是,可能是selectButton()
匹配確切的文本這在我的情況是不在那裏。請幫助
$ crawler輸出是什麼?也嘗試$ crawler-> selectButton('Create a Wish List') - > form();也許在換行方面存在一些問題 – 2014-11-26 00:10:02