Ideas for Print in a PHP System - php

im making a backend but i need to print out tickets in POS Printers, so i will explain why im asking
1.- long time ago a friend had a server (10.0.0.1) and client computers (10.0.0.2 , 10.0.0.3, etc)
so i was watching that their php POS was hosted in the LAN server so how they was printing?
2.- In the client machines (in the same lan) each machine was running wamp wit a *.txt file with the margins of the tickets and one php script called print.php so when they was asking the server (10.0.0.1) to print they was printing locally
any ideas how to achieve this? i was playing with Mike 42 ESC-Pos and runs fine but for print on a network im watching that needs the printers running on LAN or by Netbios
warm regards and thanks in advance!

Related

Print from python/PHP

So, long story short, I have a site running in my home off a Raspberry Pi (Raspbian) (secured and not shared with anyone other than me, local within the network) running a down-and-dirty file upload system. I want to configure the server to automatically send any file I send to it to the printer, and print out automatically. I have CUPS installed on the pi, but I have no idea what else to do.
the printer is a wifi printer (Xerox colorcube) if that matters
I was thinking possibly a python script?
Ok so I completed the task, and I am sharing this so any voyagers who stumble across this page don't find it unanswered.
Get the solution at the github repo

make keyboard accessible for client of remote server (Raspberry pi, php)

So here is what I wanted to do. I have an Apache2 server up and running on my raspberry pi 3, which is currently serving as a webradio using php commands and mpd/mpc. The raspberry is also connected via HDMI to a display.
I now like to have another page on the webserver which let's me start different roms in an emulator and display the output signal on the display connected to the remote server and and also lets me use a controller connected also to the remote server.
This is what I have done so far.
I have successfully installed Retroarch which is up and running.
I used exec("export DISPLAY=:0.0; retroarch -c /home/pi/path/to/config -L /home/pi/path/to/libretro/core /home/pi/path/to/rom") to start the emulator on the remote sever.
The problem is as follows. Even though I started the emulation successfully on the screen I cannot use the input devices connected to the remote server. How can I make the input devices of the server accessible with a php-command or something else? Can somebody point me to a solution to achieve this? Also the exec-command does not seem to accept my arguments besides the config file argument. I guess it has to do with user rights. But I am really stuck at this point.
Thanks for any replies.
Disclaimer: This is my first post. So I am sorry for bad terminology.

How to check if respberry pi is connected to internet from a website using php?

I am trying to make a web based home appliance automation project taking reference from here.
I am using:
RPi 3 modal B.
Website hosted on free-hosting website (000webhost).
PHP
-Python
I want to implement following more things in this:
Before activating on and off button, i want to check if the raspberry pi is on and online running python script to check if any command is provided to it, if on then only the ON and OFF button are in focus.
Since the webpage and the RPi is communicating by writing to and reading from text file, it is possible that pi turns off (due to power failure) causing the appliance to turn off but the file still contains status 'ON'. I want to check every 2-3 seconds if pi is online and working so that i can display on the website that the appliance is currently working and if pi get turned off i can display "There is some problem with Pi, check out."
I searched the web for the same but I am not getting any solution using PHP so that i can continuously check the status of my pi.
I got a solution to use cron jobs but no any free hosting website provide cron job that repeat every 2-3 seconds and the minimum time is 10 min.
Is there any way to check continuously if Pi is online from the website?
One I think is Pi itself show its online status by writing to another file but how will I make my webpage to check that file continuously or is there better method?
I will appreciate if I get any more suggestions to make this project better.
NOTE: I can only upload files on the website, i don't have any means to provide command to the server.
Not sure I entirely follow the architecture but you could look at the modified data of the file. Another thing that comes to mind is to have the Pi write a timestamp to the file instead of "ON". Using this timestamp, you will know when the file was last written and if it is more than X time old, assume the Pi is off. But you will have to make sure the clocks are all close.

TTFB too high on one computer, not on another

I have a web app for hotel that monitors guest checkin running in PHP/MySQL.
The checkin interface is composed of ajax calls that return data for a checkin to complete. The server where the web app is installed has a TTFB of 3.58 seconds.
What I did is I copied the web files and the whole database for comparison.
I installed xampp on my computer. Tried to run the same process, I got 100ms.
There are not much differences except that their server is faster than my home computer. All files and database is the same. What could be the culprit?
Here's my screenshot of Chrome's debugger tools (Home computer)
And here's their server
I hope I provided all the information you guys need to troubleshoot the issue.
I appreciate all the help I can get. Thank you.

PHP Thermal Printing Client-Side

I've got a Epson Thermal printer, model TM-T20 which I'm setting up for clients.
Our webserver is a linux server, and the client machines will be Windows machines.
Is it possible with php, to directly control the thermal printer attached to the clients computer?
I have looked at javascripts window.print(), but that is not what I want, if possible I want to bypass the print dialog.
Thanks,
Tony
No. PHP has absolutely nothing to do at all with the client's printer. If the printer was attached to the machine the PHP script is running on (i.e. the server), there may be something you could do. As it is, PHP only sends text to the client. From there, the client's browser and printer software has to handle it.
Alternatively, if the Windows box ran a print server exposing the printer that PHP could talk to over the network, you could talk to the printer directly. But that wouldn't be a normal PHP server/client relationship anymore.
printing from php isn't that easy, most web apps i have seen generate a pdf and and the clients print that.
have a look at http://www.vendhq.com/ they do a point of sale app for shops, and have something you need to download and install to print till dockets via a receipt printer. it might give you some inspiration
I have done exactly this before. It was quite tricky, using a ubuntu server on the workplace's LAN and a thermal printer on another ubuntu computer in the shipping area. That computer was running a php service listening to a port and was headless, hiding inside the cabinetry.
The business's internal web php "application" on the LAN server would coordinate with their e-commerce and UPS.com to print a shipping label. I forgot how UPS sent it but we used imagemagik to tweak the final image to the perfect pixel width. Then the LAN server would connect to the target's php socket server and it would send the proper commands to the serial port that the printer was connected to, along with the image data.
To call that solution madhatterey is an understatement... but was quite amazing to have labels appear magically upon "shipping" an order. No print dialog or anything. Cheapest solution is get an Atom box that can run Ubuntu and get a printer with a ppd file that works. Then just queue it up properly. Same concept as remote printing in linux.
You could possibly do the print request from a webpage's AJAX request and not need the extra infrastructure (or target computer's php socket server).

Categories