0
私は現在、Goutteという単純なPHPクローラーを使用しています。 Guzzleを使用してhttp GET
リクエストを実行します。私はスクレープアクションを実行することができます。しかし、私は/ filter
内部変数をエコーしようとしているが、エラーUndefined variable: x
を取得します。変数が定義されます。変数にフィルタを渡す正しい方法は何でしょうか?Guzzle/Goutte - 基本的な擦れ - 要求変数を渡す
$client = new Goutte\Client();
$crawler = $client->request('GET', 'http://github.com/');
$crawler = $client->click($crawler->selectLink('Sign in')->link());
$form = $crawler->selectButton('Sign in')->form();
$x = "hello";
$crawler = $client->submit($form, array('login' => 'xxxxx', 'password' => 'xxxxx'));
$crawler->filter('.flash-error')->each(function ($node) {
echo $x;
print $node->text() . "\n";
});