alwex/php-casperjs

Returning data from target page

Opened this issue · 3 comments

In CasperJS I would write something like:

    title = this.evaluate(function() {
        return $.trim($('.title').text());
    });

How can I achieve the same with this wrapper?

+1!

Created Pull Request #51

Whit this Pull Request you can do this:

$casper = new Casper();
$casper->start('http://example.com');
$casper->evaluateToVar('title','return $.trim($('.title').text());');
$casper->run();

$vars = $casper->getVars();
echo $vars['title'];