PHP Parser for 1C-Bitrix — Automated Product Import

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Showing 1 of 1All 1626 services
PHP Parser for 1C-Bitrix — Automated Product Import
Medium
~1-2 weeks
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1368
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    956
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    699
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    843
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    737
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1086

Imagine an online store receiving price lists from 20 suppliers in CSV, XML, and HTML formats. Manually updating 50,000 items daily leads to inevitable errors and duplicates causing lost sales. We solve this – we develop a parser in PHP embedded in 1C-Bitrix, which automatically fetches data from any source and loads it into information blocks. A PHP parser for Bitrix is 2x faster than a Python solution due to direct API access. Contact us – we'll assess the task within one business day.

Over five years, we have implemented more than 20 parsing projects for Bitrix. Each parser is designed for a specific task: whether loading 10,000 products from CSV or gathering data from a dozen competitor websites. We use PHP because it's the native language for Bitrix. The parser can work directly with the information block API, without REST or intermediate queues. This reduces complexity and accelerates development by 2–3 times compared to hybrid setups. For tasks that don't require JavaScript rendering, PHP is the best choice.

Architecture of a PHP Parser

The parser consists of four components:

  1. Source configuration. An array or database table with parameters for each source: URL, type (RSS, HTML, API), CSS selectors for data extraction, field mapping, update frequency.

  2. HTTP client. For simple tasks – cURL via CHttpClient from Bitrix core or native curl_multi for parallel requests. For complex tasks – Guzzle with middleware for retry, logging, proxy rotation. More on parallel requests in the PHP documentation.

  3. HTML/XML parser. DOMDocument + DOMXPath for precise DOM navigation. For CSS selectors – the Symfony\Component\DomCrawler library. For RSS – SimpleXMLElement.

  4. Importer. A layer for writing data to Bitrix information blocks via D7 API or the old API (CIBlockElement).

How to Speed Up Parsing by 10x?

The main bottleneck of a PHP parser is sequential requests. Loading 1,000 pages at 2 seconds each = 33 minutes. With curl_multi, you can handle 10–20 requests in parallel:

$multiHandle = curl_multi_init();
$handles = [];

foreach ($urls as $i => $url) {
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_multi_add_handle($multiHandle, $ch);
    $handles[$i] = $ch;
}

do {
    $status = curl_multi_exec($multiHandle, $active);
    curl_multi_select($multiHandle);
} while ($active > 0);

Limitation: more than 50 parallel connections – and PHP starts consuming too much memory. For large-scale parsing (10,000+ URLs), split into batches of 20–30 connections.

Integration with the Bitrix Core

The advantage of a PHP parser is direct API access. No REST, no intermediate database needed. Import into information blocks:

$element = new CIBlockElement();
$elementId = $element->Add([
    'IBLOCK_ID'    => IBLOCK_CATALOG,
    'NAME'         => $parsedData['title'],
    'XML_ID'       => $parsedData['external_id'],
    'ACTIVE'       => 'Y',
    'PREVIEW_TEXT'  => $parsedData['description'],
    'DETAIL_TEXT'   => $parsedData['content'],
    'DETAIL_TEXT_TYPE' => 'html',
    'PREVIEW_PICTURE' => CFile::MakeFileArray($parsedData['image_path']),
]);

if ($elementId) {
    CIBlockElement::SetPropertyValuesEx($elementId, IBLOCK_CATALOG, [
        'SOURCE_URL' => $parsedData['url'],
        'ARTICLE'    => $parsedData['sku'],
    ]);
}

Important: during mass import, disable search and URL update:

CIBlockElement::DisableEvents(); // Disables event handlers

Without this, each Add() triggers search reindexing, facet index updates, and other handlers – importing 10,000 products would take hours.

Learn more about working with events.

Error Handling and Resilience

A PHP parser in production must handle:

  • Timeouts – server not responding, connection hangs. Set CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT.
  • HTTP errors – 403, 429, 503. For 429 (rate limit) – increase delay. For 403 – change proxy. For 503 – retry later.
  • Invalid HTML – DOMDocument::loadHTML generates warnings. Suppress with @ or libxml_use_internal_errors(true), but log problematic URLs.
  • Memory exhaustion – large HTML pages (5+ MB) consume memory. Set memory_limit appropriately and free DOM after processing: unset($dom).

Retry pattern with exponential backoff:

function fetchWithRetry(string $url, int $maxRetries = 3): ?string
{
    for ($i = 0; $i < $maxRetries; $i++) {
        $response = @file_get_contents($url);
        if ($response !== false) {
            return $response;
        }
        sleep(pow(2, $i)); // 1, 2, 4 seconds
    }
    return null;
}
Common errors and handling strategies
Error Type Strategy
Connection timeout Retry after 5 seconds, up to 3 attempts
HTTP 429 (Too Many Requests) Increase delay between requests, use proxies
HTTP 403 (Forbidden) Change User-Agent, proxy, authentication
HTTP 503 (Service Unavailable) Retry with exponential backoff
Invalid HTML Activate libxml_use_internal_errors, log URL
memory_limit exceeded Split into batches, free DOM

Logging

Without logs, debugging a parser is impossible. Minimal set of events to record:

  • Start and end of parsing session (time, number of processed URLs).
  • Each HTTP request: URL, response status, load time.
  • Parsing errors: URL, error type, context.
  • Import result: created, updated, skipped (duplicates), errors.

Use \Bitrix\Main\Diag\Logger from D7 or write to a separate parser_log table.

Comparison: PHP vs Python for Parsing

Criterion PHP Parser Python Parser
Integration with Bitrix Direct API call (no REST) Via REST – 20-30% slower
JS rendering No (HTML only) Yes (Puppeteer, Playwright)
Maximum volume per session up to 50,000 pages up to 500,000 (async)
Development speed from scratch 5-10 days 7-14 days (two systems combined)

When PHP is Not Enough

A PHP parser is not suitable when:

  • JavaScript rendering is needed – SPA websites, dynamic content loading. Here a headless browser (Puppeteer/Playwright) is required, which means Node.js or Python.
  • Parsing volume exceeds 50,000 pages per session – PHP hits limits with single-threading and memory consumption.
  • Complex text processing (NLP, classification, entity extraction) is required – Python's ecosystem is much richer.

In these cases, consider a hybrid approach: Python/Node.js for data collection, PHP for import into Bitrix.

Parser Development Stages

  1. Source analysis – determine data structure, format, update frequency.
  2. Architecture design – choose parsing scheme, parallelization, error handling strategy.
  3. Implementation – write PHP code, integrate with information blocks and external systems.
  4. Testing – load testing with real data, simulate failures.
  5. Documentation and handover – architecture description, operation manual, developer training.

What You Get

  • A working parser embedded in your 1C-Bitrix instance.
  • Full documentation and code comments.
  • A 3-month warranty on parser performance after project delivery.
  • Free post-project support.

Developing a PHP parser costs 2 times less than a hybrid Python+Node.js solution, and maintenance is 3 times cheaper because all logic resides in one system.

Order parser development – we guarantee results and full documentation. Get a free engineer consultation.

Parser Development for 1C-Bitrix: Where to Start?

XMLReader, not SimpleXML — the choice of tool determines the project's fate. SimpleXML loads the entire XML into memory, and with an 800 MB supplier file, PHP will crash with a fatal error on a 512 MB limit. XMLReader processes streamingly, node by node, consuming 20–30 MB — 30 times more efficient. This detail starts any parser development for Bitrix. With over 10 years of Bitrix development and 50+ parser projects delivered, we know the pitfalls. Contact us to start your parser development today.

What Problems Does Parsing Solve?

  • Primary catalog filling — 15,000 cards with descriptions, characteristics, photos. Manually, that's three months of content manager work; a parser takes a week with debugging.
  • Competitor price monitoring — collecting data from Ozon, Wildberries, competitor sites. A competitor drops the price on a hot item — you find out in two hours, not two weeks.
  • Supplier aggregation — five price lists in different formats (CSV with CP1251, XML in CommerceML, Excel with merged cells) become a single catalog with a unified property system.
  • Card enrichment — pulling characteristics, instructions, 3D models from manufacturer sites. Without this, a product card is an SEO empty shell.
  • Assortment update — products missing from the supplier feed are deactivated via CIBlockElement::Update($ID, ['ACTIVE' => 'N']). New ones are created. The catalog stays synchronized.

What Tools Do We Use in Parser Development?

Static websites — PHP (Goutte, Symfony DomCrawler) or Python (Scrapy, lxml). Speed: 50–100 pages/sec. Sufficient for catalogs without JS rendering.

SPA and dynamic websites — Puppeteer or Playwright. Infinite scroll, AJAX filters, lazy-load images — headless browser handles it all. Speed drops to 1–10 pages/sec, but there is no alternative: data exists only after JavaScript execution.

Supplier files:

  • Excel (XLS, XLSX) — PhpSpreadsheet. Beware of merged cells and formulas — they break automatic mapping.
  • CSV — fgetcsv() with correct encoding. Suppliers love CP1251, BOM in UTF-8, and semicolons instead of commas. All need detection and handling.
  • XML/YML — XMLReader for large files, SimpleXML for feeds up to 50 MB.
  • CommerceML — standard exchange format with 1C. We parse import.xml and offers.xml, map to information block structure.

API — Supplier REST endpoints, marketplace APIs (Ozon Seller API, Wildberries API). We work within rate limits, handle pagination.

How Is the Auto-Population Pipeline Structured?

Four stages. Each can break in its own way.

  1. Collection. Parser crawls sources via cron schedule. Raw data goes to an intermediate table — not directly into b_iblock_element. Log everything: pages visited, elements parsed, where we got 403 or timeout. Without logs, debugging a parser is like fortune-telling.

  2. Normalization. Main work here:

    • Clean HTML tags, extra spaces, Unicode garbage
    • Units: "mm" → "mm", "millimeters" → "mm", "миллиметр" → "mm"
    • Map supplier categories to Bitrix information block sections. One supplier has "Notebooks", another "Notebooks and tablets", third "Laptops" — all into one section
    • Deduplication by SKU, EAN/GTIN. One product from three suppliers should not appear three times
  3. Load into Bitrix. Via CIBlockElement::Add() for new elements, CIBlockElement::Update() for existing. Images: download, resize via CFile::ResizeImageGet(), convert to WebP. Properties via CIBlockElement::SetPropertyValuesEx(). SEO meta via \Bitrix\Iblock\InheritedProperty\ElementValues. SEF URLs generated from name transliteration.

  4. Update. Key point — not overwrite manual edits by content manager. Update only price, stock, activity. Description and photos manually edited are flagged with UF_MANUAL_EDIT property and skipped during import. Products missing from feed are deactivated, not deleted.

Why Is Competitor Price Monitoring Necessary?

A separate subsystem with its own specifics:

Parameter How It Works
Frequency From once a day to every 2 hours — depends on market volatility
Matching By SKU, EAN, fuzzy name comparison via Levenshtein distance
Storage Separate vendor_price_monitor table with history, not information blocks
Alerts Telegram/email when competitor price deviation exceeds X%
Auto-rules "Keep price 3% below competitor minimum, but not below cost + 15%"

Result — dashboard: your product vs competitors, price history, trends. The manager sees where to raise price without losing position, and where to react.

CSV/XML Import Module: Customization for Your Format

For supplier files — custom module with admin panel:

  • Configurable mapping: "column B in file → BRAND property of information block"
  • Auto-detect encoding (CP1251, UTF-8, UTF-16) via mb_detect_encoding() with validation
  • Download images from URL with queue — to avoid channel saturation
  • Incremental update by row hash: row changed — update, no — skip
  • Cron schedule, report: created 145, updated 892, errors 3 (with details)

Large files: CSV processed in batches of 1000 rows via fgetcsv() (10 times faster than row-by-row), XML streamed via XMLReader, background execution via Bitrix agent queue — no PHP timeouts.

Legal Aspects to Consider

  • robots.txt — respect it. Crawl-delay — comply.
  • Request frequency — 1–2 per second, no more. Don't DDoS someone else's site.
  • Manufacturer content — use it. Unique author texts — don't copy.
  • Personal data — don't collect.

What Is Included in a Turnkey Parser Development?

Component Description
Prototype Parser for 1–2 sources in 2–3 days to assess data quality
Main parser Full data collection from one source (static/dynamic)
Bitrix import module Normalization, loading, update, mapping admin panel
Price monitoring If needed — collection and alert system (up to 10 competitors)
Documentation Architecture description, selector update instructions
Support 3-month guarantee for uninterrupted operation, fix for donor layout changes

How We Work and Deadlines

  1. Prototype — parser for 1–2 sources in 2–3 days. Assess data quality, pitfalls (Cloudflare protection, captcha, dynamic loading).
  2. Development — full pipeline: parser → normalization → import into Bitrix → admin panel for management.
  3. Testing — run on full catalog volume, check edge cases (empty fields, malformed HTML, broken images).
  4. Launch — configure cron, error monitoring via Telegram bot.
  5. Support — competitor changed layout? Update CSS selectors in parser.
Task Deadlines
Single site parser (static HTML) 3–5 days
SPA site parser (Puppeteer/Playwright, bypass protection) 1–2 weeks
CSV/XML import module for Bitrix 1–2 weeks
Price monitoring system (5–10 competitors) 2–4 weeks
Comprehensive auto-population system 4–8 weeks
Parser support and adaptation by subscription

Get in touch for a free consultation — we will analyze your data sources and propose the optimal parser architecture. Request a project assessment today and get a fixed deadline. We guarantee stable parser operation and full support throughout the usage period.