Skip to content

Instantly share code, notes, and snippets.

@farrelley
Created June 6, 2012 00:03
Show Gist options
  • Save farrelley/2878982 to your computer and use it in GitHub Desktop.
Save farrelley/2878982 to your computer and use it in GitHub Desktop.
Trying to get a list of TTB ID numbers for a specified date. The code works but I am missing something. I keep getting an error "<?php require_once 'goutte.phar'; use Goutte\Client; $client = new Client(); $guzzle = $client->getClient(); $guzzle->se
<?php
require_once 'goutte.phar';
use Goutte\Client;
$client = new Client();
$guzzle = $client->getClient();
$guzzle->setConfig(
array(
'curl.CURLOPT_SSL_VERIFYHOST' => false,
'curl.CURLOPT_SSL_VERIFYPEER' => false,
)
);
$client->setClient($guzzle);
$client->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6');
$crawler = $client->request('GET', 'https://www.ttbonline.gov/colasonline/');
$link = $crawler->selectLink('Public COLA Registry.')->link();
$crawler = $client->click($link);
$form = $crawler->filterXPath("//form[@name='searchCriteriaForm']")->form();
$form->setValues(array(
'searchCriteria.dateCompletedFrom' => '06/04/2012',
'searchCriteria.dateCompletedTo' => '06/04/2012',
'searchCriteria.classTypeFrom' => 900,
'searchCriteria.classTypeTo' => 959
));
$crawler = $client->submit($form);
$txt = $crawler->filterXPath('//html');
var_dump($txt->text());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment