How can i invoke a paper scanner using php code? - php

How can I invoke a paper scanner using php code?
I have already used Dynamic Web TWAIN for scanning, but it is not free.
I need an open source code to scan.
Please help me. Thank you in advance.

PHP is a server side language and cannot interact with client side hardware. You can use a web-based TWAIN SDK to scan documents in your PHP app. Check out this article which might help: http://www.dynamsoft.com/blog/document-imaging/how-to-scan-documents-in-php
You can also use Scanner.js: https://github.com/Asprise/scannerjs.javascript-scanner-access-in-browsers-chrome-ie.scanner.js
Maybe you can try phpSANE: https://sourceforge.net/projects/phpsane/
phpSANE is a web-based frontend for SANE written in HTML/PHP so you
can scan with your web-browser. It also supports OCR.
PHP Printer library: https://github.com/mike42/escpos-php

I was in a similar position as you and found there were 0 open-source libraries.
Thus, I created a library https://github.com/spacemudd/webagent-scanner.
What you need to do:
Install Python 2.7.
Navigate to webagent-scanner's root folder and run: python setup.py py2exe
In dist/ and open app.exe. This will create a localhost web server w/ port 8087.
In your web application, ensure the user has app.exe running.
Use Javascript to make a GET request to https://localhost:8087/scan
The response of the GET request... you inject it in a form to send it to your PHP backend.

Related

Can PHP be accessible offline?

My Employer would like me to take a web application written entirely in PHP to be accessible while offline. (it has to be accessible by an ipad without internet connection.)
I have tried the following things:
http://solesignal.com/draftcode/
http://blog.smartbear.com/codereviewer/15-code-editors-for-the-ipad-for-free-or-very-cheap/
https://itunes.apple.com/us/app/offline-pages-save-complete/id364859644?mt=8
Before I'm going to spend any money i have to be 100% positive it works.
Does anyone know how i can achieve this?
What do you mean by offline?
If you're looking to embed the server within your app, you're out of luck, it's not possible nor allowed. However if you want to run a local environment in your computer, take a look at MAMP
Knowing more about Mike's question, He's trying to run a website/webapp made in PHP offline/stand-alone on iOS devices.
As PHP is a pre-processor, this is not possible without a seperate server doing the magic. Depending on what this application has to do, I suggest you try to re-make the webapp so it does not use PHP. A lot of the things done with PHP can also be done client-side with JavaScript.
If you require more sophisticated things, try looking into the Meteor Framework. It supports PhoneGap exportation natively so the applications can run stand-alone on mobile devices as apps.
EDIT: If you can use an android device, you CAN run a PHP server on the same device as the pages are displayed because android is simply more open then iOS. If you're not willing to re-write the PHP code to JS, grab an android tab and use a PHP server package for android like this or another one that does include a MySQL server like this one

where I can find demo to combine SQL / PHP in Blackberry app?

I need help to programming an App that need a data from SQL Server and somehow I have to update the data too. The app will be a client side and the server will have all the database. did BB allow us to connect to PHP directly or I need to make a HTML so that page will run the JS?.
Can anyone help me, where I can find the demo? or sample about Sql and app?
I have already install eclipse and Blackberry SDK 7.1.
Lets assume you are building a horoscope app:
You input a date and zodiac sing and you get your horoscope from the server.
In this case, your client can be build from few HTML pages styled with CSS.
If you need something more fancy you can use JavaScript.
On the server side, you will need running DataBase, and support for PHP (running Apache).
In the simple variant your client will send requests (from a Form or Ajax) to
www.myServer.com/my_php_back_end.php and will display the response.
This is just a simple scenario so you can form your question better.
PHP_MySQL-Creating-Form

Web application to sync data with Android phone application

I already know quite a few tricks with Android java and I have an application that I need to sync with a web application. What it needs to be doing is connect to a server and sync database and download jpg picture uploaded by user. The web application should also be for more users each with his own phone and Android application in it, so it should probably be accesable via login and password.
My problem is that I have zero experience with web applications. All I know is a little HTML. So my question is, how should I start? What language do I use? And what basic structure or principle should my web application have?
Thank you!
I would recommend a PHP - MySQL solution. PHP and MySQL are open source and I know Java can interface with that kind of database. Both languages are well documented and PHP is similar to Java in that it is C-based, so if you know Java fairly well, PHP should be relatively straightforward for you. I would recommend heading over to Lynda.com and searching for PHP Essential Training with Kevin Skoglund. Lynda is a great online video tutorial site and you can access a good amount of the content for free. But if you're serious about developing this web application, I would make the investment (I was, and I did, and I am glad). That's how I learned PHP / MySQL for the most part.
First off, to do any PHP / MySQL development, you'll need to install a server onto your computer, such as WAMP (Windows Apache MySQL PHP - for windows), MAMP (Mac " " - for mac), or LAMP (Linux " " - for Linux), where you will be able to begin developing your application. This is your "test" server, or "development" server. For instance, I use MAMP since I am on a Mac. MAMP is free, as are the other versions, but you can pay for an upgrade. For your purposes, start with the free version. Essentially, *AMP comes with the Apache Server software, MySQL database installation, and PHP installation pre-packaged and ready to go with minimal configuration. From there, you can start writing PHP and MySQL and get your project rolling.
As a matter of fact, that title at Lynda.com, PHP Essential Training, will walk you through ALL of the steps I just stated, AND, uses an exercise project of setting up a basic Content Management System to include password protection, user login and authentication, as well as all of the essential PHP and MySQL that you'll need to go along with it. Seriously, check out Lynda.com.
Good Luck!
This is a very open question and you might get a huge range of different answers, neither of them perfect. However, I will try to put a simple response.
Have a single server and expose from it web services. This web services will handle the CRUD of the data (I will assume you will use a database and that you have experience with databases).
Web services is a big topic. If you want the simplest web services, and you're planning to use PHP, I will suggest using RESTful with JSON, since it will be very simple.
The web application should be within the same domain/server of the web services, at least for the beginning (if it grows, you can change this architecture), since that way you won't require using JSONP and just stick to standard AJAX (I will now assume you don't know what JSONP is, I will suggest reading: http://remysharp.com/2007/10/08/what-is-jsonp/ which is just the first result I got on Google just now ;)) and it will be easier.
You say you have experience with Android. I will assume you know how to consume web services using Java/Android. In case you don't, here's a sample of how to do it: http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
Please note the PHP code there is pretty dirty, but as a "how to", I think it looks great. Only thing to note is: the sample uses HttpClient, while the preferred method is to use HttpURLConnection ( http://android-developers.blogspot.mx/2011/09/androids-http-clients.html)
Having said this, PHP + MySQL is standard. In the web app, you SHOULD USE HTML. Please, don't use Flash or Java Applets (I smiled a bit by even mentioning Java Applets in here). For all the communication purposes between the web service and the HTML client, I recommend using jQuery ( http://jquery.com/ ) with AJAX.
Don't go with a JSONP API unless you want other websites to be able to use your API.
This is only a quick approach created with the little information you have given. The more (and clearer) information you give, a better solution is likely to appear.

Dreamweaver's build app function in cs 5.5 breaks if there is php code?

For javascript and html files only, Dreamweaver's build app for android function seems to work great in cs 5.5. But when any php code is put in (for authentication, or for ajaxing in web service returns ) it seems that the android app just displays broken php code instead of executing it. When building the app, Dreamweaver won't even let you use a root php file in the project; it only seems to only accept html files.
Am I doing something wrong? Building apps out of web language-based files seems a lot less useful if server-side code isn't allowed.
Are there any other alternatives? Titanium studio looks really complicated, but I'm willing to read the docs if it's worth the time.
http://help.adobe.com/en_US/dreamweaver/cs/using/WSeffff8bffc80208478c8d43312e240fe0ad-8000.html
Indeed it only packages HTML, CSS and Javascript into an Android or iOS package.
I'm afraid you'll have to learn real Android development if you want something more complex.
Dreamweaver will package the files up just like you asked, however, the destination system is what runs the code. Android doesn't execute the PHP within the app. Your app has to connect with a remote server that is to handle the log in. Thinks of two separate apps, one on the phone and one on your server.
Android doesn't execute the PHP within the app. This is because PHP is a server side client and Not client side. Unless they create some inbuit servers within phones from which native apps can tap into. One option you can use is to use html files and within them, create links to php files which are in online servers so as to have your scripts executed.

Notification message using php

I am developing an application in php. I need to display a notification message on windows taskbar. So please help me...How to do it using php.
With PHP, your domain is the web browser. You can display a message in the browser or in a pop up window. You can't connect to the operating system.
Probably PHPGTK can help you. But your question smells a bit, because as Sohnee mentioned PHP is made for creating web pages or things which are highly connected to the web.
However, it could help us if you provide much more information what you do, why you do it, and so on...
You could change the window title using ajax to display a message in the taskbar. That's as far as you can go using a webapp i think.
You might want to look for a Growl library. On Widows it would require some additional software. Google turns up:
http://forums.cocoaforge.com/viewtopic.php?f=6&t=16872
http://github.com/tylerhall/php-growl/tree/master
With C# for .NET you can easily write a notifier application which resides in the tray.
I just have written an XML based notifier application which communicates (XML data transfer) with a server that runs php. The IDE comes with a sample notifier application. If you are familiar with c# then go and get it.
It's open source
Goto SharpDevelopment IDE
What you can do, is develop a program that does this in another language, and then call it via system() in PHP.
Note that the notification will only pop up on the server. Since no actual PHP code is run on the client's machine.

Categories