---
title: "Cctv Direct — Project Dossier | Isaac Machakata | Isaac Machakata"
description: "A small php package I was tasked with making to scrap data from this website."
canonical_url: "https://isaac.co.zw/projects/cctv-direct"
meta:
  author: "Isaac Munyaradzi Machakata"
  "og:description": "A small php package I was tasked with making to scrap data from this website."
  "og:image": "https://isaac.co.zw/_og/s/o_d19dea887573ea44.png"
  "og:image:alt": "Cctv Direct — Project Dossier | Isaac Machakata"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Cctv Direct — Project Dossier | Isaac Machakata"
  "twitter:description": "A small php package I was tasked with making to scrap data from this website."
  "twitter:image": "https://isaac.co.zw/_og/s/o_d19dea887573ea44.png"
  "twitter:image:alt": "Cctv Direct — Project Dossier | Isaac Machakata"
  "twitter:title": "Cctv Direct — Project Dossier | Isaac Machakata"
---

> Index of every page on this site: [llms.txt](https://isaac.co.zw/llms.txt)

[← Curriculum Vitae](https://isaac.co.zw/#projects)/ [ Projects](https://isaac.co.zw/projects) /#CctvDirect

**open-source** Public Repo active ★ 2

# **Cctv Direct**

Codename: **#CctvDirect** · Repository: **immachakata/cctv-direct**

[Visit Live Deployment (github.com/immachakata/cctv-direct)](https://github.com/immachakata/cctv-direct) [View on GitHub](https://github.com/immachakata/cctv-direct)

Primary Language**HTML**

Last Updated**Jun 26, 2023**

Created**Jun 26, 2023**

Branch / Size**main · 27 KB**

## **Executive Summary **

A small php package I was tasked with making to scrap data from this website.

## **GitHub Codebase Language Breakdown **

**HTML**93.7%

**PHP**6.3%

## **Repository Documentation (README.md) **

Fetched from GitHub

# PHP Data Miner

[Permalink: PHP Data Miner](#php-data-miner)

Fetches data from a certain website.

## Installation

[Permalink: Installation](#installation)

Clone or Download the code and install the dependencies using Composer `composer install`

## Usage

[Permalink: Usage](#usage)

Include the autoload file and setup and headers.

```
use CctvDirect\Scrapper;

include __DIR__ . "/vendor/autoload.php";

header('Content-Type: application/json');
```

## # localhost scrapping

Permalink: # localhost scrapping

The following scrapes data from the file in the bin folder

```
$results  = array();
$scrapper = new Scrapper();
$scrapper->scrape('http://localhost/bin/dahua-analog-hd-cctv-cameras.htm');

// ? localhost demo scrapping $collection = $scrapper->collection;
$results    = array(
    'title' => $collection->getTitle(),
    'category_slug' => $collection->getCategorySlug(),
    'products' => $collection->getProducts(),

    // 'collections' => $collection->getCollections(),
);
// ? print results
echo json_encode($results, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
```

## # live scrapping

Permalink: # live scrapping

In this example, we get the collections from the file in the bin, then scrap products from the live site.

```
$collections = $scrapper->collection->getCollections();

foreach ($collections as $collectionUrl) {
    $scrapper->scrape($collectionUrl);
    $results[$scrapper->collection->getCategorySlug()] = array(
        'title' => $scrapper->collection->getTitle(),
        'products' => $scrapper->collection->getProducts()
    );
}
```

## **Recent Repository Commits **

`5ad2f6b`doc: minor changes

Jun 26, 2023

`bcd71a4`refactor: fetch from server by default

Jun 26, 2023

`188ce19`feat: use custom fetch function

Jun 26, 2023

`ee36582`fix: null values on images

Jun 26, 2023

`7687e0a`fix: null values on image alt and title

Jun 26, 2023

### **Stack & Repository Topics **

**HTML** #oss #portfolio #web-scraping

## **Related Work & Projects **

[All projects →](https://isaac.co.zw/projects)

### [Ci4 Facades – PHP](https://isaac.co.zw/projects/ci4-facades)

★ 1

[packagist.org/packages/immachakata/ci4-facades](https://packagist.org/packages/immachakata/ci4-facades "https://packagist.org/packages/immachakata/ci4-facades")

A lightweight PHP package for CodeIgniter 4 that brings clean, expressive, Laravel-like traits and facades to your project—starting with database migrations and logging

#codeigniter4 #codeigniter4-library #oss

### [Ci4 Relationships – PHP](https://isaac.co.zw/projects/ci4-relationships)

★ 3

[packagist.org/packages/immachakata/ci4-relationships](https://packagist.org/packages/immachakata/ci4-relationships "https://packagist.org/packages/immachakata/ci4-relationships")

Simple nested model relations for CodeIgniter 4 framework

#oss #portfolio

### [Codels Sms Php – PHP](https://isaac.co.zw/projects/codels-sms-php)

★ 2

[packagist.org/packages/immachakata/codelsms](https://packagist.org/packages/immachakata/codelsms "https://packagist.org/packages/immachakata/codelsms")

PHP wrapper for 2waychat.com bulk sms by sms.codel.tech

#2waychat-sms #bulk-sms #codel-sms

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://isaac.co.zw/#website","@type":"WebSite","name":"Isaac Machakata","url":"https://isaac.co.zw/"},{"@id":"https://isaac.co.zw/projects/cctv-direct#webpage","@type":"WebPage","description":"A small php package I was tasked with making to scrap data from this website.","name":"Cctv Direct — Project Dossier | Isaac Machakata","url":"https://isaac.co.zw/projects/cctv-direct","isPartOf":{"@id":"https://isaac.co.zw/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://isaac.co.zw/projects/cctv-direct"]}]}]}
```

## Sitemap

See the full [sitemap](https://isaac.co.zw/sitemap.md) for all pages.
