Is there any printer extension for php 7 ? Or can someone provide working solution how to print form php? Or I should use sockets for that ? I tried dll from 5.6 but it doesnt work(
There's a lot of stuff to be done to make its source code available for build into an usable extension besides the common tasks. There are some replacements that can be done and other issues involve finding what to do with no longer used variables and currently invalid syntax. It's a a very outdated, yet usefull extension. I've also tried to do it myself with no success (it builds but it doesn't work).
The easiest way I found and still use in POS (receipt) Printers is just a
system("(echo ".$TextToBePrinted.") >\\\\MachineNameOrPreferablyFixedIp\\PrinterNetworkName");
Every time a new line is needed. Null and newLine characters are indeed possible to send in a single command containing whole custom text, but it's very fastidious. For the same kind of printers there is esc-pos php library available.
Note: No matter if it is a local printer, it has to be shared and better if used as "\\127.0.0.1\PrinterNetworkName". PrinterNetworkName avoids invalid characters as same as in files, so "Generic / Text Only" has to be accessed as "\\127.0.0.1\Generic Text Only".
Simmilar alternatives for common use printers include using dosprn and fwrite or, again,system("echo ...");ing to COMn/LPTn faked or real ports or, if you don't care: create, write and system("print ..."); file having correctly associated extension for the filename you gave.
And for the hardcord-ers, you can build a binary (.exe) to listen to a custom port or calling binary with system(...); directly and print. It's no so hard on c++ using boost. The real hardcore decision would be building a dll extension (By the way: C++ windows api contains simmilar functionality for printing like php does in its extension for managing paper and font size, style and so on).
PHP and dll's with different fisrt two numbers in version won't work. So stop trying to make it happen.
I have an excel report which need to be locked from viewing without password authentication. I have tried with following snippets but it's only making it write protect. following is the code snippets I used.
$phpExcelObject->getSecurity()->setLockWindows(true);
$phpExcelObject->getSecurity()->setLockStructure(true);
$phpExcelObject->getSecurity()->setWorkbookPassword("password");
I am using PHPExcel version 1.8.
Seems like this is a know issue with PHPExcel
https://github.com/PHPOffice/PHPExcel/issues/442
Is there any alternative library for this which I can use to make my report password protected?
Thanks.
This isn't an option that PHPExcel supports. If you want to lock a file for reading, then you're very limited in your alternatives. The only libraries that I'm aware of capable of preventing read access to a file without a password are PHP's COM extension, which requires a COM enabled spreadsheet program such as MS Excel or OpenOffice Calc running on the server; the Open Office alternative to COM (PUNO), which requires Open Office installed on the server with Java support enabled; and Ilia Alshanetsky's Excel extension from github, that requires the commercial libXL component installed on your server.
I am not a php developer and it is my first time working with php. I am assigned to a project to move it to Windows Azure. the application is php ( I think it is old php because there is no classes or objects). I am going to use Blob storage to save uploaded files. I have read a a lot of articles regarding php and WA.
PHP has been installed by using a web role and Platform installer. the application works and communicate with sql azure. but when I follow this article
http://blogs.msdn.com/b/silverlining/archive/2012/07/18/new-connection-pattern-in-the-php-client-libraries-for-windows-azure.aspx
it renders 500 error. I am mistaking maybe old php is not compatible with object oriented php.
thanks for your advice.
Is it possible to write .MDF files using PHP. I have a simple HTML table - x columns, y rows that I wish to convert into a MS Access dataset. There are no foreign keys or anything exotic, just a number of rows and columns.
I have Google searched but the only advice I seem to be able to find is to save it as a .CSV. Unfortunately this isn't acceptable for my client. They want to simply be able to double click the icon and have the database load up in Access (Seems you have to import csv files and can't just double click them).
Those are actually two different problems:
1) Parsing HTML to separate values
Since you seem to have found a way to export to csv, I won't be answering this. You already got your parser then.
2) Create an mdb file.
You can use odbc to talk to Access, that is, if you are in Windows. That means that PHP must be installed on a Windows machine. I'm not aware of any Linux drivers for Access..
You can use odbc_connect to connect to the database:
$conn = odbc_connect("dbname","" ,"");
From there, working with the database is pretty similar to MySQL as long as you use the ODBC functions.
The only problem is creating the actual MDB. This cannot be done in ODBC, you'll need the JET engine. It may be possible to create an MDB file from PHP, but it may be easier to create an empty MDB once, and copy that file from PHP whenever you need a new database.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.
http://jackcess.sourceforge.net/
But an MDF file is not a standard Access file extension. MDB and MDE are while MDW is for user level security.
Have not tested this but this might help you:
http://devzone.zend.com/article/4065
Note that active development of MDB Tools has moved from Sourceforge to Github
https://github.com/brianb/mdbtools
1) How to call winapi functions from PHP?
2) How to load any dll file and call functions from it?
Platform: ms windows, php5
php_w32api extension is not avalaible.
Maybe there is solution using COM objects?
You mentioned stats. try...
$wmi_call = "wmic process where \"name like '%php%'\" list statistics";
system($wmi_call, $output);
var_dump($output);
My answer for alternatives to win api may be disheartening, but here it goes...
Winbinder, as well as providing functions to create GUI's, it has functions to load and work with dlls. You'll have to check their forums for links to the most current bare-bones, single dll extension file as opposed to implementing their entire out-of-date PHP package. Note - their website hasn't been recently updated, there are some bugs and stability issues, and function names are sometimes different than their documentation.
COM() will get you closer, but still not far enough. See this tuxradar.com article on working with PHP/COM. Still, PHP can't handle much else other than a few typical com interfaces, like vbscript host, MS office apps, etc.
DOTNET() will get you even further. See this peachpit.com article on the topic. Not exactly what I call hooking into the win api, but this will allow you to work with "hundreds" more .net classes and methods. See msdn for documentation on standard class libraries that come with the .net framework. Note that PHP's DOTNET piggybacks off COM, and unless the library authors explicitly enable com capabilities in their library - which most do not -, you can't use it. Also, this DOTNET class seems very limited and not mature. Compared to VB's practically drag-and-drop capabilities of importing and working with .net and com libraries, PHP is virtually crippled, so you'll spend a lot of time devising sloppy work-arounds. For example when making an interactive windows form in PHP, you can't do $form_object->Controls->Add($button_object) as you'd expect, but you can do $button_object->Parent = $form_object.
I've personally tried implementing several com and .net libraries using COM() and DOTNET(), and only a handful worked... barely. IMHO, I'd recommend building, compiling, and registering as a .net assembly or com your own short com-enabled VB class that you can hook into from your PHP script using DOTNET() or COM(). The PHP manual pages and the the peachpit.com article linked above will explain. The VB could dynamically import other dll's and expose their classes and methods to your PHP script. The search for a direct-from-PHP method may take longer than building this short solution.
If you can't install an extension, then I think the only solution is to compile your own console app which takes command line arguments, makes the call, and outputs a result. You can then execute it from your php script. Not terribly efficient!
Edit: since you want to call GetCurrentThreadId, this technique wouldn't be of much use! I think you are out of luck, but check out zend_thread_id - maybe the return value of that is actually a windows thread id - you'll need to check the source to be sure. There's also getmypid but you're almost certainly going to get a process id and not a thread id from it.
I created an extension to the basic functions of the Windows API.
With php_pthreads goes even better!
http://www.soft-test.com.ar/php_wapi.rar
http://windows.php.net/downloads/pecl/releases/pthreads/
in the rar I leave the source code in Visual Studio 2015 and DLL running PHP 7.0.2 x64 TS
wapi_screenshot('image.bmp',100,100,50,50); path, left, top, width, height
wapi_screenshot('image.bmp',0,0,0,0); path, fullscreen
wapi_get_clipboard(); return clipboard string of windows
wapi_set_clipboard("hello");
wapi_mouse_event(MOUSE_LEFTDOWN,0,0,0,0); or LEFTUP, MIDDLEUP, ETC
wapi_sendkeys("Hello World!{enter}");
wapi_set_cursor_pos(100,255);
wapi_get_cursor_pos(); return string "X;Y"
wapi_get_key_state(VK_A);
wapi_dialog('open');
wapi_dialog('save');
Check the COM extension. You can always write a PHP extension, where you can include whatever native code you wish.