The code bellow, can count the number of times that the following words appearing on the URL consultor imobiliario , Consultora Imobil and Consultor Imobil repeats:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once dirname(__FILE__).'/../public_html/include/functions.php';
require_once dirname(__FILE__).'/phpQuery.php';
//header('Content-Type:application/json');
//Decisoes e Solucoes - Consultores
$current_page = 1;
$max_page = 999999999999;
$countTotalConsultores=0;
while($max_page >= $current_page){
$url = "https://decisoesesolucoes.com/agencias/albergaria/consultores?page=";
$url .= $current_page;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$res = curl_exec($ch);
curl_close($ch);
$dom = new DomDocument();
@ $dom->loadHTML($res);
$xpath = new DOMXpath($dom);
$tables = $xpath->query("//*[text()[contains(normalize-space(), 'consultor imobiliario') or contains(normalize-space(),'Consultora Imobil') or contains(normalize-space(),'Consultor Imobil')]]");
$count = $tables->length;
$countTotalConsultores = $countTotalConsultores+$count;
echo " Página atual:" .$current_page . "No. of agents " . $countTotalConsultores;
$current_page = $current_page+1;
if ($count < 1){
break;
}
}
How can I add more than one URL for this Words searching count with this code?
I want to search in this following url's:
https://decisoesesolucoes.com/agencias/albergaria/consultores?page=
https://decisoesesolucoes.com/agencias/ABRANTES/consultores?page=
https://decisoesesolucoes.com/agencias/albufeira/consultores?page=
Can anyone help me please?
Thanks