0 Answer
  • 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

split text of scrape

On the website I am trying to scrape, all the information is under the same class (.panel-row-text). I am unsure how I can split this info so that it is just displayed under the relevant title, as right now each line will show all of the data.

Also a simple way of feeding this info into a database would be a brilliant help.

Thankyou very much for any help offered!

    const axios = require('axios');     const cheerio = require('cheerio');      const url = 'https://www.lseg.com/resources/1000-companies-inspire/2018-report-1000-companies-uk/search-1000-companies-uk-2018?results_per_page=100';      axios(url)       .then(response => {         const html = response.data;         const $ = cheerio.load(html);         const dataTable = $('.tabular-data-panel > ul');         const companyData= [];                 //console.log(dataTable.length);          dataTable.each(function(){             const companyName = $(this).find('.panel-row-text').text();             const website = $(this).find('.panel-row-text').text();             const sector = $(this).find('.panel-row-text').text();             const region = $(this).find('.panel-row-text').text();             const revenueBand = $(this).find('.panel-row-text').text();              companyData.push({                 companyName,                 website,                 sector,                 region,                 revenueBand,             });          });          console.log(companyData);        })       .catch(console.error);  
Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]