Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Suggest a method to take input as command-line-arguments from a single text-box in Web-Browser.
These numbers are then added using C code and Display the result again in the Web-Browser.
Suggest, How can I use PHP or HTML to link my C code?
I haven't done php for a long time now ...
If I understand you well I would do that :
Your html should send the request (http GET request) with the two numbers to your server (from your form).
The triggered php script should use the shell_exec command from php to execute a c program.
The program shall print the sum to the console (http://php.net/manual/en/function.shell-exec.php).
Then the result string would be sent back to the webbrower
I hope I'm right.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Just wondering if a php code could be executed via Google Tag manager?
Thanks
No. The Google Tag Manager inserts client-side Javascript. PHP requires a server that is configured for PHP. Inserting a PHP script via GTM would just output the raw PHP code to the browser, it would not execute the code.
If you want to include the results of a PHP Script you would have to run the script on your own server and fetch the results via Javascript as suggested in UncleRicos answer.
I would look at Custom Events in Triggers here: https://support.google.com/tagmanager/answer/6106961?hl=en&ref_topic=3441647&vid=1-635797415927700239-1991783559
You can specify a javascript event that would be called upon a trigger being executed, which in turn could call a routine via ajax (which could be PHP or anything).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How knows how the browsers render the html and server side codes? does the browser render it line by line? or do the server side code first then the html? specially in php? And is there a way to force the browser to do the php code first, and then the html, or not?
Any help?
Server-side code is never sent to the browser. The server executes the PHP code and sends the resulting HTML to the browser, which then parses it. It already does what you want.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How can I see the Edit Mode page is the link is written like:
<small><i>Edit Mode</i></small>
In the above case, if I click the Edit Mode button in the homepage, does it mean editz will be assigned a value as 1?
Another question is if I have three php files a.php, b.php and c.php, which all check isset($editz), how can I redirect the page to a.php, rather than file b or c if I click the Edit Mode button?
Sorry maybe my question is too simple a naive, but I am a newbie to php, it is my first time tough php code. Please be kind to share some light:)
Just to give some sort of answer to this, spanning from the comments:
Anything following a ? in a URL is a query string, and the parameters (each separated by &) can be accessed with the $_GET['parameter_name'] function. In this case, $_GET['editz'] was needed.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I would like to know how to get the location of a computer that goes on a website like Google maps and it asks if you if it can get your location but in PHP and then prints it on a webpage.
You could attempt find the location by running a php executed shell command of tracerout on the $_SERVER['REMOTE_ADDR'] but there are many factors which make that method very unreliable.
If you need the location of the computer executing your application. I recommend using HTML5 geolocation http://www.w3schools.com/html/html5_geolocation.asp
and passing the data back to the server via AJAX or some other posting method like a form.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a bash script which I want to take a parameter, it all works fine normally so that is not the issue.
What is I want is an HTML (or PHP if need be) which will take text entered into a text field and execute a bash script with it as a parameter.
I had my HTML working last night with some embedded PHP (I didn't attempt to pass argument at this stage):
<?php
exec("/scriptname.sh");
?>
This however would simply not execute the script (yes it is located at /). I had a simple "echo test > testfile" command which obviously did not run.
What is the easiest way to do what I need, and an example would also be great.
Thanks a lot for taking the time to read this.
have a look on shell_exec
$output = shell_exec('/scriptname.sh p1 p2 p3');
Documentation
http://www.php.net/shell_exec