Solved

Script to send card reader data to a server without using the browser

Posted on 2013-01-23
6
422 Views
Last Modified: 2013-02-12
Hi,

I am trying to send data from a card reader to a server (mySQL database) without going trough a web browser. When swiping the card it will return a digit (xxxxxxxxxxx) and this number will be sendt to a script on the server. This script will submit it into the database.

Do you know how to make a listerner script that will take the data and send it to a "logg.php" on the server? ... on Windows 7
0
Comment
Question by:Hans Inge Hagen
  • 3
  • 2
6 Comments
 
LVL 13

Expert Comment

by:frankhelk
ID: 38808948
Would you please elaborate a bit more on that process ? I'm not sure how a web browser could be needed anyhow.

What does the barcode scanner device in detail (actice, passive, protocol, etc.) ?

If it contacts a server via HTTP, i.e. by accessing a URL like then there are several ways, i.e.

use some web server like apache, IIS, etc. and plug in some kind of script for this (CGI, PHP, ASP, whatever)
use Tomcat and implement a Java servelet for that
create an own application that listens on the HTTP port and implements just as much of HTTP as needed to communicate with the device

The script could do anything you desire with the code. Using some kind of web- or applet server would come with multithreading capabilities without the need of coding this, meaning i.e. intrinsic support of multiple barcode scanners without the hassle of collisions.

If the device acts different, I'll have to meditate again over this :-)

Possibly you can give the type of the barcode device and some link to a manual ?
0
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 38808994
why to a logg.php ?? which involves the web at all and a php routine running on the server?

instead take the output of the card reader and then send it directly to mysql in the format your database requires.. What does the card reader output right now? .. The above requested information would be nice as well. Where are we listening ? is there a specific port and what format are we waiting for?

Too many questions.. not enough answers to even start a reasonable answer
0
 

Author Comment

by:Hans Inge Hagen
ID: 38851903
My Card-reader (mifare) is on a USB (simulated com port 4) .. it will give me a number (1234567890). This number needs to be sent to a mysql server (not on the same machine) and added as a record together with a timestamp ... This is a members log system on a gym.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 13

Accepted Solution

by:
frankhelk earned 500 total points
ID: 38879259
OK - so your reader sits on an emulated serial interface.

I would recommend to just use some high level programming language of your choice (VB, C++, etc.). Maybe you could use VB.NET express (free).

As example, you might use the SerialPort class available in VB.NET to communicate with your reader. After initializing the reader, I presume it sends the number followed by [CRLF] or embeds it in control character sequences like [STX]...[ETX]. You'll need to filter the number out of the data.

Then use the database access classes (contained in VB.NET, too) to stuff the data into the database, using any kind of additional data (i.e. a timestamp) and/or format.

The generated program then would sit on your database server PC, or (if that database is abroad) on some small interface PC connected to both reader and network. As long as it runs, it will serve as interface between reader and database.
0
 

Author Closing Comment

by:Hans Inge Hagen
ID: 38880329
I do not know VB .. but I will search for an solution somewhere. Thanks
0
 
LVL 13

Expert Comment

by:frankhelk
ID: 38881912
Try to learn - with Visual Studio Express it's free, with some knowledge of programming it's easy to learn. It's worth the effort.

Try "Visual Studio 2012 Express für Windows Desktop" or "Visual Studio 2010 Express All-in-One ISO".
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now