PHP code example of jansuchanek / nscraper

1. Go to this page and download the library: Download jansuchanek/nscraper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jansuchanek / nscraper example snippets


use NScraper\WebScraper;

$scraper = new WebScraper();

// Scrape Heureka.cz product descriptions
$data = $scraper->scrapeHeureka('Samsung Galaxy S24');
// ['descriptions' => [...], 'source' => 'heureka']

// Google search snippets
$data = $scraper->scrapeGoogle('Samsung Galaxy S24');

// Scrape any URL (JSON-LD, meta, content extraction)
$desc = $scraper->scrapeUrl('https://example.com/product/123');

// Build context for AI pipelines
$context = $scraper->buildCompetitorContext('Samsung Galaxy S24');