i'm trying to open MyComputer using COM class ... whould you help me with the name of MyComputer in COM class ??
For example , if you wanna open NotePad you do this :
<?php
$shell = new COM("WScript.Shell");
$shell->Run("notepad.exe");
$shell = null; ?>
Run("notepad.exe"); works for notepad , but when i use Run("mycomputer.exe"); i face error :
Fatal error: Uncaught exception 'com_exception' with message 'Source: UnknownDescription: Unknown' in E:\Localhost\root\test.php:3 Stack trace: #0 E:\Localhost\root\test.php(3): com->Run('computer.exe') #1 {main} thrown in E:\Localhost\root\test.php on line 3
i appreciate any help from you my dear friends <3
you can try :
<?php
$shell = new COM("WScript.Shell");
$shell->Run("explorer.exe ,");
$shell = null; ?>
when we add "," it open My computer.
Related
This is my scenario:
I have a web server running php
I have a client with a receipt printer
I have a HTML form that retrieves various data from the user and stores them in a database. Then I can access it as I want.
What I want to do is that when I click on a print button, the server sends a command to the printer to print the ticket.
I'm trying to do this with Mike32's escpos-php library but I can't do it.
Here is the php file I made
<?php
require 'vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
$data = "Hello world !";
$printerName = 'Custom';
$clientName = 'LAPTOP-J3MTKIN3';
$connector = new WindowsPrintConnector("\\\\$clientName\\$printerName");
try {
$printer = new Printer($connector);
$printer->text($data);
$printer->cut();
$printer->close();
} catch (Exception $e) {
echo "Erreur : " . $e->getMessage() . "\n";
}
?>
Here are the 2 errors I get:
Warning: preg_match(): Compilation failed: invalid range in character
class at offset 29 in
/var/www/html/vendor/mike42/escpos-php/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php
on line 126
and
Fatal error: Uncaught BadMethodCallException: Printer
'\LAPTOP-J3MTKIN3\Custom' is not a valid printer name. Use local port
(LPT1, COM1, etc) or smb://computer/printer notation. in
/var/www/html/vendor/mike42/escpos-php/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php:155
Stack trace: #0 /var/www/html/test_impression.php(22):
Mike42\Escpos\PrintConnectors\WindowsPrintConnector->__construct() #1
{main} thrown in
/var/www/html/vendor/mike42/escpos-php/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php
on line 155
I have successfully installed ZeroMQ in WAMP, see the screenshot below.
However I am getting Error:
Fatal error: Uncaught Error: Class 'ZMQContext' not found in C:\wamp64\www\0MQ\zguide\examples\PHP\hwclient.php:9 Stack trace: #0 {main} thrown in C:\wamp64\www\0MQ\zguide\examples\PHP\hwclient.php on line 9
when I run a test script in a browser:
TEST SCRIPT:
<?php
/*
* Hello World client
* Connects REQ socket to tcp://localhost:5555
* Sends "Hello" to server, expects "World" back
* #author Ian Barber <ian(dot)barber(at)gmail(dot)com>
*/
$context = new ZMQContext();
// Socket to talk to server
echo "Connecting to hello world server...\n";
$requester = new ZMQSocket($context, ZMQ::SOCKET_REQ);
$requester->connect("tcp://localhost:5555");
for ($request_nbr = 0; $request_nbr != 10; $request_nbr++) {
printf ("Sending request %d...\n", $request_nbr);
$requester->send("Hello");
$reply = $requester->recv();
printf ("Received reply %d: [%s]\n", $request_nbr, $reply);
}
How may I deal with this?
I added this configuration line:
[ZMQ]
extension=php_zmq.dll
to php.ini located in:
c:\wamp64\bin\php\php7.1.9\php.ini
rather than in:
c:\wamp64\bin\apache\apache2.4.27\bin\php.ini
This solved the problem.
On my webpage I'm using PHP and I run it in Ubuntu 16.04.
It works well.
Then I try to run it on CentOS 5.11 (I know centOS 5.11 is out of date, but for many reasons I must I use it).
And the result is my webpage doesn't work.
I show this error:
Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Permission denied' in /var/www/html/IPU-GUI/website2/templates/sql_login.php:3 Stack trace: #0 /var/www/html/IPU-GUI/website2/templates/sql_login.php(3): mysqli_connect('127.0.0.1', 'root', '123456', 'ipu1') #1 /var/www/html/IPU-GUI/website2/sip.php(30): require_once('/var/www/html/I...') #2 {main} thrown in /var/www/html/IPU-GUI/website2/templates/sql_login.php on line 3
Here is my code:
<?php
require '../functions/server_info.php';
$conn = mysqli_connect($sql_login["host"], $sql_login["username"], $sql_login["password"], $sql_db);
if (!$conn) {
echo mysqli_connect_error();
}
?>
And server_info.php
$sql_login = array(
"host"=>"127.0.0.1",
"port"=>"3306",
"username"=>"root",
"password"=>"123456"
);
$sql_db = "ipu1";
UPDATE: I try to fix this error by change "host"=>"127.0.0.1" to "host"=>"localhost" it works.
But I don't know what wrong? What different from "127.0.0.1" and "localhost".
This is the first time I use parse.com php SDK and I try to execute the following code
<?php require '../autoload.php';
use Parse\ParseObject;
use Parse\ParseClient;
ParseClient::initialize( "Zsr...", "BzM..", "D..." );
$gameScore = new ParseObject("GameScore");
$gameScore->set("score", 1337);
$gameScore->set("playerName", "Sean Plott");
$gameScore->set("cheatMode", false);
try {
$gameScore->save();
echo 'New object created with objectId: ' . $gameScore->getObjectId();
} catch (ParseException $ex) {
// Execute any logic that should take place if the save fails.
// error is a ParseException object with an error code and message.
echo 'Failed to create new object, with error message: ' + $ex->getMessage();
}
?>
But I get that error
Fatal error: Uncaught exception 'Parse\ParseException' with message 'SSL certificate problem: unable to get local issuer certificate' in /opt/lampp/htdocs/parse/src/Parse/ParseClient.php:250 Stack trace: #0 /opt/lampp/htdocs/parse/src/Parse/ParseObject.php(925): Parse\ParseClient::_request('POST', '/1/classes/Game...', NULL, '{"score":1337,"...', false) #1 /opt/lampp/htdocs/parse/src/Parse/ParseObject.php(836): Parse\ParseObject::deepSave(Object(Parse\ParseObject), false) #2 /opt/lampp/htdocs/parse/src/hola.php(11): Parse\ParseObject->save() #3 {main} thrown in /opt/lampp/htdocs/parse/src/Parse/ParseClient.php on line 250
The code it's the tutorial code, iI haven't changed anything anyone knows what's the problem?
I am also getting same issue. Now I resolve using some other forums answer.
Open your ParseClient.php and find:
curl_init();
And after that add line add:
curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, false);
It will work.
I want to convert PPT to PNG with PHP. I wrote the following piece of code to solve the problem:
$powerpnt = new COM("PowerPoint.Application") or die('could not create the powerpoint instance');
$powerpnt->Visible = True;
$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"])));
$FileName = "MyPP";
$powerpnt->Presentations->Open("D:\\MySlide.ppt"); /* This is line #16 */
$powerpnt->ActivePresentation->SaveAs($strPath."/".$FileName,17);
$powerpnt->Quit;
$powerpnt = null;
But I got the following Fatal error:
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Office PowerPoint 2007<br/><b>Description:</b> PowerPoint could not open the file.' in C:\wamp\www\ppt2jpg\ppt2jpg.php:16 Stack trace: #0 C:\wamp\www\ppt2jpg\ppt2jpg.php(16): variant->Open('D:\MySlide.ppt') #1 {main} thrown in C:\wamp\www\ppt2jpg\ppt2jpg.php on line 16
How can I solve this problem?
Thanks in advance.