Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to read/access the bar-code scanner values using PHP & MySQL?

I am trying to enable a PHP website to recognize barcode input.

I will load a web page in a browser, the focus (cursor) is set to recieve input into the text box.

I will be having a barcode reader/scanner plugged into the PC and will scan the barcodes one-by-one using the scanner. Would the information from the barcode can be put into the text box of the web page ?

The important question is that how can I read the output from the scanner using PHP ?

Please advise.

like image 478
Mithun John Jacob Avatar asked Aug 29 '11 07:08

Mithun John Jacob


People also ask

Can we get data from barcode?

The purpose of a barcode scanner is to scan or read a barcode symbol and then provide an electrical output to a computer via a decoder and cable. The decoder recognizes the type of barcode symbology it is seeing, translates the bar and space content and transmits data to a computer in a human readable format.

How a bar code reader reads a bar code?

A barcode reader works by directing a beam of light across the bar code and measuring the amount of light that is reflected back. (The dark bars on a barcode reflect less light than the white spaces between them.)

Can a barcode reader read any barcode?

Not all barcode scanners can read all barcodes. Laser barcode scanners and linear imagers read only 1D barcode scanners. Imager (camera-based) 2D barcode scanners read all common 1D and 2D barcodes.


2 Answers

Had a similar problem. Barcode scanners work like keyboards, they just enter a string. The scanners can usually be configured so that they add a prefix or a postfix to the characters read from the barcode, often on a per barcode-type basis (can have different config for Code 39 than for Code 128 e.g.)

But, a problem that we had in our last project was, that the guys that developed the cashier system also configured the barcode scanner and they put a CTRL-B as a prefix in front of every barcode. In Firefox, this opens up the Bookmarks and so you´re trapped.

What I mean is, connecting the scanner is easy, but you have to care for the configuration of the scanner if there are control character that might be captured by the browser or some other software. On the other hand, this can be very useful cause you can enter a linefeed after each barcode or something else that helps you separate them.

Another important aspect in our case was the timing. The barcode scanners enter the character quite fast, but - at least the one we had - entered it one by one. So when we tested our functionality, there was a huge difference between the string pasted from the clipboard or the string scanned from the barcode. This was relevant for Ajax-Calls we did (where in our case, a ZK-based website had lots of trouble with that).

Hope that helps.

like image 123
mkraemerx Avatar answered Oct 29 '22 14:10

mkraemerx


This is not a programming question per se. Bar code scanners work just like a keyboard, they input the digits scanned.

The easiest way is to just create a form with a textbox and then post it and handle it with your PHP code

like image 39
Oskar Kjellin Avatar answered Oct 29 '22 12:10

Oskar Kjellin