linux - How can I direct output from a program to fill a form on a webpage? -


my 1d barcode scanner appears input device in linux allowing me fill web page form barcode scans if manually typing input. need replicate 'scan--put data web form' behaviour using 2d barcodes read webcam , extracted command line utility. utility i'm using (zbarcam), prints detected code stdout whenever barcode detected---very nice! need somehow redirect stdout stream current web page in browser can fill in text box data. seems simple redirection problem can't figure out how make work. perhaps there way make utility act 'virtual' input device?

i go way.

first send output of app temp location, file automatically updated everytime read new barcode.

zbarcam <params> > /tmp/barcodeoutput 

then create script 1 automatically using ajax , jquery refresh contents.

index.php

<html> <head>     <title>jquery ajax</title>      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>     <script type="text/javascript">  $(document).ready(function() {      $("#content").load("feed.php");    var refreshid = setinterval(function() {       $("#content").load('feed.php?randval='+ math.random());    }, 2000);    $.ajaxsetup({ cache: false }); }); </script> </head> <body>      <pre id="content">      </pre>  </body> </html> 

and last file php file index.php call using ajax.

feed.php

<?php readfile('/tmp/barcodeoutput');   ?> 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -