I have a strange setup at the moment (busy with a migration)
I have a 4th Dimension application which calls php scripts (which is our soon to be, only application. Dropping 4D)
This script thats called from 4D needs to open a html file in the browser.
Is this possible?
Iv'e tried something along the lines of
header('Location: ./DischargeLetter.php?id='.urlencode($id));
This passes the html document (report) that I want to open along with the patient id.
calling it in the browser works (obviously hey), but how can I get php to open the browser or a tab and head to that page?
From what I understand you have a command line script in php and you are trying to open a browser on the server?
If you are using the php like a command scripting language you can use http://php.net/manual/en/function.shell-exec.php to call other commands so you can call something like
shell_exec('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe $url');
Related
I am experimenting with using AWS. To be specific, I am following the tutorial at this link:
https://aws.amazon.com/getting-started/hands-on/build-web-app-s3-lambda-api-gateway-dynamodb/module-three/?e=gs2020&p=build-a-web-app-two
I have tried to add empty PHP tags to the start of the file and renamed the file to index.php instead of the index.HTML of the tutorial. I did a full sequence of refreshing the web app resources and deploying the app on the Amplify console. It did not work. I tried only using the HTML code on index.php and it still did not work. I put back the PHP code, added an echo statement echo "<h1>PHP Code Ran</h1>"; but renamed the file to index.html and it did render. Granted, there was an error in the text output. It also wrote the ending semi-colon and ending quotation, but it worked.
Is there any way for me to use a file named index.php as the home page of a web app using AWS amplify?
A PHP file isn't just an HTML file with a different name: you need to have a server somewhere that's running PHP which will look at the PHP code and run it.
If you're just uploading files to S3, that's not going to happen, the file is just going to be sent straight to the browser, regardless of what you call it and what you put in it.
Putting <?php echo "<h1>PHP Code Ran</h1>"; ?> into a file "worked" only in the sense that when you opened the page in the browser, you saw your browser's best attempt to interpret that as HTML. If you go to "View Source", you'll see that the file is exactly what you uploaded to S3, no PHP has run at all.
If you want to write a PHP application, you need to understand how to run PHP - most likely on an EC2 server, but it could also be in a Fargate container, or something even fancier like bref which lets you run PHP in a Lambda function.
Can anyone tell here, what is the command to run html with php script. Normally in my linux terminal, if i want to run html, my command is
firefox <filename>.html
It works fine and display output in firefox browser. But some how, when I add php script, the browser doesn't show the output from php script. It show source code. I try the answer from the forum below, it doesn't work for me.
Using .htaccess to make all .html pages to run as .php files?
How to run a php script inside a html file?
So here, i want to ask
1) What is the step to run html with php script
2) what is the command to run?
3) The source code, need to save in .html or .php ?
Is there any way to run php in browser without using apache?
Rename file.html to file.php and check.
I think you write PHP and HTML in a single document, and you use only html extension.
You can't run php codes without install PHP package on your OS. your browser can't understand your php code without this package, So your browser show source code.
After that you can run php file as a page or put it into a html page by iframe html tag.
I am using ajax to call a php file passing along the data I want written to an Excel file. I do not want to save the Excel file on the server, but want to use the $objWriter->save('php://output'); (part of PHPExcel) to open it in the browser.
If I copy the ajax script call into my browser (outside my web application), the browser creates the file and the browser gives the user the option to open/save it.
But...when I run it through the ajax call in my web application, nothing shows up.
I've seen many posts where people had similar issues, but they do not really match what I am trying to do. Most seemed to actually create the file on the server and then return the file name back as the result to the ajax call and then open that file. Since I am not creating a file on the server, that won't work for me.
Is there a way to accomplish this with ajax, php, and PHPExcel? Is there a way to open the file as part of the $objWriter->save('php://output') statement?
Well I got around the issue....instead of calling the script using the ajax call, I did a window.open and used the script call I was using for the ajax call as the input. So what it does is temporarily open a window, which in return calls the php script (passing all parameters). Once the Excel file is created, the window closes but the browser file shows for the user. So except for a window temporarily flashing, the end result is what was originally desired.
I'm a frontend developer and I'm facing with a problem.
Whenever I'm building a website, I'm using PHP to include the template files, so I get a redundant code.
But when I want to generate this file into an HTML file I open up the PHP file in the browser to copy/paste the code to an HTML file.
How can I make this process to be way much faster, or how could I avoid to do these things manually? Maybe there is a program to do this or something?
You can use a recursive wget.
Say your webserver runs on your localhost, you can run:
wget -r -k localhost
Be careful: wgetdoes not perform a search on which pages are available, it simply looks at links (the <a> tags) and will capture these as well. As long as everything is reachable from the index page (not necessarily on the index page), it will be downloaded.
wget is a linux program, but I guess there is a Windows application with the same name/options as well... As #rkbvkleef points out, it's part of the MinGW package.
Basically your php file (which runs on server, could be local server) contains or generates your HTML code to present on browser. You can simply write HTML code out of tags in a php file and it will work. Or if you want to generate some HTML based on some conditions you are checking inside php or using some variables in php then you can use echo function. It will display whatever string you echo on your webpage.
<?php
$name = "Murtaza";
echo("<h1>Hello ".$name."</h1>");
?>
Is it possible to view the output of a PHP script in the Run Tool Window as rendered HTML?
I have an application that generates HTML output and currently I need to copy it from the console, save it in an HTML file and open that file in a browser to view the rendered output.
Eclipse PDT has a view called "Web Browser", for instance.
Unfortunately no -- PhpStorm (and any other IDE built on IDEA platform AFAIK) does not have such functionality.
You may submit Feature Request ticket to their Issue Tracker .. but I doubt that it will be implemented any time soon (very limited usage case, as far as I see it right now).
I may suggest to save such output into .html file directly (if you can edit such script -- at least during your debug/test sessions) and open it in browser (then simple "Refresh" in browser will do the job).
If you are executing the PHP file in the console and then manually copying the html code and saving it to a file and finally running it, running this command might help :
php file.php | cat > file.html | google_chrome file.html
Or maybe you can just do :
php file.php | cat > file.html
and refresh the page in the browser.
In this case you won't have to manually copy the code each time.