Created
February 3, 2014 14:28
-
-
Save franmomu/8784784 to your computer and use it in GitHub Desktop.
Goutte Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__.'/vendor/autoload.php'; | |
use Goutte\Client; | |
$client = new Client(); | |
// Login page | |
$crawler = $client->request('GET', 'http://x3demob.cpx3demo.com:2082/?locale=en'); | |
// Select Login form | |
$form = $crawler->selectButton('Log in')->form(); | |
// Submit form | |
$crawler = $client->submit($form, array( | |
'user' => 'x3demob', | |
'pass' => 'x3demob', | |
)); | |
// PHP Configuration page | |
$link = $crawler->selectLink('PHP Configuration')->link(); | |
$crawler = $client->click($link); | |
// Find PHP Configuration rows | |
$configurationRows = $crawler->filter('#phptbl tbody tr'); | |
$configurationRows->each(function($configurationRow, $index) { | |
$directive = $configurationRow->filter('td')->eq(1)->text(); | |
$value = $configurationRow->filter('td')->eq(3)->text(); | |
echo sprintf("%-20s = %s\n", $directive, $value); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"fabpot/goutte": "1.0.*@dev" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment