Ejemplo n.º 1
0
 public function afterRequest(Request $request)
 {
     //The HTMLParser sets up the XPath document that we are going to use to extract the result
     $parser = new HTMLParser($request->getResponse()->getBody());
     $result = $parser->query("//*[@class='ent-name']");
     //Add each product to the result set
     foreach ($result as $pokemon) {
         $this->result[] = $pokemon->nodeValue;
     }
 }
Ejemplo n.º 2
0
 public function afterRequest(Request $request)
 {
     //The HTMLParser sets up the XPath document that we are going to use to extract the result
     $parser = new HTMLParser($request->getResponse()->getBody());
     $result = $parser->query("//a[@class='productTitle']");
     //Add each product to the result set
     foreach ($result as $product) {
         $this->result[] = trim($product->nodeValue);
     }
     //Increment the page counter in order to construct the correct URL for the next round-trip
     $this->page++;
 }