PHP Classes

How to Use a PHP QRCode Library to Process QRCode Images Decoded by the Browser Using JavaScript with the Package QR Code PHP: Process decoded QR Code received from the browser

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-08 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 92 All time: 9,917 This week: 62Up
Version License PHP version Categories
qrcodephp 1.0GNU General Publi...5PHP 5, Graphics, AJAX, Business
Description 

Author

This package can process decoded QR Code received from the browser.

It uses a JavaScript library from Minhaz that can process a QR Code image scanned with a camera, and decode the QR Code so it can be sent to the Web server using an AJAX request.

The package has a PHP script that can receive the QR Code sent by the Web browser, store the code in a file, and then respond to the browser request to tell if the QR code submission succeeded.

Innovation Award
PHP Programming Innovation award nominee
June 2024
Number 3
QR Code is a standard for defining an image representing a code that can be quickly scanned with a camera.

Web browsers can scan images on devices with Web cams or cameras built-in mobile phones. Once the image is scanned, it needs to be decoded.

This package uses a JavaScript library that can decode scanned QR Code images. The decoded QR Code can be sent to the Web server using AJAX requests. A PHP script on the server side can process the decoded QR code.

Manuel Lemos
Picture of Marcelo Telles
  Performance   Level  
Name: Marcelo Telles <contact>
Classes: 5 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 2x

Example

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
   
$data = json_decode(file_get_contents('php://input'), true);
   
$qrcode = $data['qrcode'];

   
// Processar o QR code conforme necessário
    // Exemplo: salvar no banco de dados, procurar informações, etc.

   
$nomearq = "Dados_.txt";
   
$arquivo = fopen($nomearq, "a");
   
fwrite($arquivo, $qrcode."\n");
   
fclose($arquivo);

   
$lines = file($nomearq, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
   
$reversedArray = array_reverse($lines);

   
// Para este exemplo, apenas retornaremos o QR code recebido
   
echo json_encode(['status' => 'success', 'qrcode' => $reversedArray]);
} else {
    echo
json_encode(['status' => 'error', 'message' => 'Método não permitido']);
}
?>


  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file bootstrap.min.css Data Auxiliary data
Accessible without login Plain text file html5-qrcode.min.js Data Auxiliary data
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file qr_handler.php Example Receive and process the decoded QR Code

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:92
This week:0
All time:9,917
This week:62Up