Call Exec To Run An External Program Through A Form
I have problem with "Exec" function in PHP5. When I call Exec to run an external program through a form, it fails but when I run my PHP page by PHP interpreter like: PHP MyPHP.php it just works fine and external program executes successfully.
View Complete Forum Thread with Replies
Related Forum Messages:
Exec() Call To External Program
We are trying to use the exec() or system() calls in a php script. The program we are trying to call takes 1 parameter in the form of: email@domain.com[usercode] There are no spaces in the parameter at all and we have tried placing quotes around just to see if it mattered. We have also modified the parameter just to send it hello. Here is what we get: With no parameters the php script executes the program where it displays the error message from the program stating that not enough parameters were supplied. We then add the word "hello" to the end after a space so the command looks like this: command "hello" and the program no longer executes at all. No matter what we do, if we supply an argument to the command the php code will not execute the program.
View Replies !
Sessions? External Program / External Program
I am trying ac ouple of days now to learn some things on SESSIONS,but I think I am not getting it very clearly. I have a PHP page tha contains a form. Users enter data in the form, which are then written in a file (the file is created at the time a user enters some data) The file is then given as an input to an external program The external program runs and gives some results which are then stored in another file (that is created when the external program finishes) What I want to do is to somehow create these files and, when the user exits from the browser, then both files that refer to this user, will be deleted. Code:
View Replies !
External Program Via PHP
I need to execute a command-line program through PHP. I have a form which includes a textarea, where the user writes his data. These data will be used as input for the commend-line program. Will I go something like: $data = $_GET['info']; Which function shall I use? System, exec, shell_exec, passthru? I can't choose which one is the correct. By the way, the command which I use when I write the script in the command line is : program_name [argument1 -> A database file] [argument2 -> info supplied by user] So, in the function that will be used, the data supplied by the user will be passed as my second argument (the 1st argument is a file in my hard disk). And, lastly, do I need to change any global settings for PHP in order to perform such actions, ie running scripts via PHP programs?
View Replies !
How To Run External Program
i would like to use php to run external program in window environment like open a macro program to let it run at window background. I try to use exec to run the window command, it works, but when i try to use exec to run other program, like this.. exec("run xxxx.ttl") // xxx.ttl is a macro the php will hang... anyone has sample on how to use php to run external program in window environment??
View Replies !
Cannot Get The Program To Run At All Through Exec
I downloaded the program called Snapshotter which allows you to take screenshots of webpages through the command-line. Server is Win2k3/XP (live/local). I cannot get the program to run at all through exec while the same directory/permissions for ffmpeg run fine. I cannot even get it to spit out the default output you get if you run it without arguments. exec("dir") works fine, but exec("c:lahSnapshotter") doesnt return anything. Registered the path in the PATH environment and still no luck, yet exec("c:lahffmpeg") works fine and returns data.
View Replies !
Opening An External Program
I was wondering if there was a way to be able to create a PHP program that when you click on a link or image on a webpage that it would automatically open up an application in the client's computer. I have a webpage that is sort of an 'engineering catalog'. Each item on that catalog is linked to a downloadable file. When a user clicks on this item, it should be able to open an engineering application, and pass the downloadable engineering file from the webpage into the engineering software application. Any ideas?
View Replies !
How To Launch External Program
somebody know how to lauch external program? for example: i will open my browser, click one image of that web page and then the application (i.e media player )of my local pc will pop up and ready to use.
View Replies !
Execute External Program
I need to execute a command-line program through PHP. I have a form which includes a textarea, where the user writes his data. These data will be used as input for the commend-line program. Will I go something like: Code:
View Replies !
Exec Wont Run A Cpp Program
I'm trying to get Zonminder up and running on FC4 One of the asso programs is zmu.cpp - compiles fine. And runs from the command line IE. /u/l/b/zmu -help returns Usage. zmu -m 2 -z (real cmd) from cmd line does what it should do. However (in xx.php) exec ("/usr/local/bin/zmu -m 2 -z", $ret); doesn't. From what I can tell it doesn't even enter the program. Permissions are 755. If I change the exec to ("ls") - works, date - works. I've compared "env" - nada. SafeMode = Off. Is there ?anything? else that might cause my problem?
View Replies !
Exec A Commandline Program
I made a topic about this before, but got one post helping, and nothing more, even though the post did not solve the problem. I need help uploading a file and sending it to a commandline windows executable. The program is called nconvert.exe, I will be uploading dds textures and converting them to bmp pictures, then immediately offering them back for download, not storing them on the server. The command to convert a file is this: nconvert -out bmp %1 %1 being the file passed to the executable.Â
View Replies !
How Do I Make Sure That An External Program Does Actually Exists?
web host said there is a program /usr/bin/convert I can use to convert image files, after I call it in my code, it does not seemed to be doing anything. I'm sure the command line is right because I echo the commandline to make sure. How do I make sure that an external program does actually exists? I use if (file_exists "/usr/bin/convert")), is there any othe way? Or am I doing something wrong that the system call is not working? For example: //convert test.jpg to converted.jpg $command = "/usr/bin/convert "test.jpg" "converted.jpg""; echo $command; system($command);
View Replies !
Start External Program (winamp)
I have my own PHP/apache/mySQL server at home with public IP address and I have my personal page there. I wan't to have a button (input type button) and a PHP function -> onClick start external program and end srcipt. I've tried do it with Exec and fopen functions but it freezed and didn't run the program Code:
View Replies !
Problem Calling External Program
have a little problem with exec/passthru or similar. I need to open an email-client from php to send an email. One would now ask why not use a normal phpmailer. It is only for use on my personal computer, and if needed I need to be able to change some input before sending the mail. The Client is KMail on SUSE 9.1. Code:
View Replies !
Php Exec To C Program That Writes File
I'm trying to use the exec() call in php to run a program that I've written and compiled from C. This program attempts to create a new file and write data into it. If I simply run the program from the shell, it writes the file no problem. If i run the program through an exec call in a php script, however, the program executes but it seems to not have the correct permissions to be able to write the file.
View Replies !
Use Exec To Run The Program Directly From The Server.
I have an image manipulation program that is run from commandline, I have never used exec before and I'm scared to becuase I don't want to mess up my server or anything. Basically, I want people to be able to upload an image, then arrange for some manipulations to take place on the file in a temporary batch file, then use exec to run the program directly from the server. The program is called nconvert.exe, and the main thing I want to do is convert DDS textures into BMP files, the command, from Windows "cmd" is: nconvert -out bmp %1 %1 being the dds file to be manipulated. How would I go about doing the exec part? I know how to do the upload, but not the exec.
View Replies !
Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server this is the php script <html> <head> <?php exec ('notepad'); ?> </head> </html> but when i execute the php script on my computer , notepad doesnt not run i used a process viewer and discovered that notepad is running in the background and i cannot see it does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)
View Replies !
Securing Data Between PHP Script And Exec'd Compiled 'C' Program
I'm using RSA Securid Tokens, and I'm going to write a little 'C' program that takes as input the userid (i.e. "jsmith") and the number displayed on the token (i.e. "123456") and returns a result code indicating whether authentication is successful. The compiled 'C' program will be called from a PHP script. I know that if I pass the parameters on the command line, i.e. authenticator jsmith 123456 the parameters are world-visible (via "ps -Af", for example) and this is an information leak. <BEGIN QUESTION> How can I pass things securely between the PHP script and the exec'd program? <END QUESTION> One way I suppose I could always use is to create a file from the PHP script and then just pass the filename to the program (assuming permissions and UID/GID were all set up correctly). But is there a more elegant way that doesn't create files, such as pipes or shared memory?
View Replies !
External Script Call
When the user submit a file, this file is transmitted to a php page that will call a perl script to process the file. The execution time can take up to one minute and I would like to keep the user informed all along the execution by printing the output of the perl script as it comes. (the perl script prints information about it's status : "15% complete") I can't figure out how, and right now the php hangs until the perl script has finished and I get all the perl script output in the end, in one time. Here is my code: <? (...) echo "Ok, File upload succeeded<br>"; $file_path= "C:somewhereupload".$name; echo "<br>"; echo system("C:hereis_myscript.pl $file_path"); unlink($file_path); (...) ?>
View Replies !
Call A Script/program
If you modify a php script/program can you call the script yours? I mean if you make changes that enhances the value of the program or allows it to do more than in its original state, would you be able to call it your own? Or do you get part credit?
View Replies !
Exec, Passthru Disabled So How To Call C++ .exe File?
I am at my wit's end trying to get information out of Streamline.net's support dept about my problem. They reply quickly enough, but seem to try and give out the least possible amount of info each time. The transcript so far is reproduced for your amusement below. To summarise: I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in a php script to solve a puzzle and output the solution. It works fine with Apache/php on my own machine, but it seems Streamline.net disable exec, passthru etc. They eventually say, cryptically: ' CGI executables are supported, however this is very different from executing a program from within a PHP script'. So how would I call my Sudoko.exe file? The 'dialog': My last question seems to have been 'fixed' before being answered, so I'll have another go. I'm trying to call an .exe file on the server but get an 'unable to fork' error message. I have Apache/php installed locally and it works fine. Do you have to turn on 'cmd.exe' permissions or something? Try it yourself at: Warning: passthru(): Unable to fork [Sudoku.exe (argument...)] in (.php file...) It's the same with exec() as well. We do not support passthru or exec functions. So how would I call my Sudoku.exe program from a php script? I do not want 'scripting help', I just want to use some of the functions that you offer as a host and which I have paid for. As I have said what I am trying to do works perfectly on my machine, so it must be a question of something you have to enable your end. What do you mean you don't support passthru or exec? They are both standard php commands. . You asked "how would I call my Sudoku.exe program from a php script?" clearly this is asking us how you can use scripting? Certain functions are disabled in PHP for security reasons. Which functions are 'disabled in PHP for security reasons' ? You can find this out with the inbuilt php function phpinfo() Could you tell me where on the page that phpinfo() produces these functions are listed? For example, passthru() does not appear to be on the page. . search for "disable_functions" on that page. disable_functions lists 'no value'. So again, could you tell me where I can find the list of standard php functions which you have disabled? Please can you provide a link to your phpinfo file so we can investigate this further. We had previously checked this on a linux server, which showed the functions that have been disabled. We've passed this on to an engineer to investigate further. For your information the following are disabled: shell_exec,exec,system,passthru,popen Your knowledge base says: Q. Are CGI (Common Gateway Interface) executables supported? A. Yes these are supported on either the Windows and Linux servers But you are telling me that the only php functions which can call my executable are disabled. Will you clarify once and for all if I can call my exe file or not. I AM NOT ASKING FOR SCRIPTING HELP, I have books about that. I just want to know if I can do ON YOUR SERVER what you say I can do, and if not why not.
View Replies !
GLOBAL OBJECT IN EXEC COMMAND CALL
I have an object: $special = new special; Let's say I have a function: class special { function outputtext() { return "test"; }} now let's say I want to use the exec command to output that text: exec("/usr/local/bin/php -r 'echo $special->outputtext();'",$returnarray,$returnvar); I get an error call to a member function on a non-object. Any ideas how to pass teh GLOBAL OBJECT var into the shell exec command? I am haivng a terrible time figuring out what to do.
View Replies !
Executing Multiple Shell Commands Via One Exec()-call
I wrote a PHP shell script under Linux which puts all existing [E]PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file) { $bla[] = fopen("./trash/".$file.".tmp", "w"); exec ("gv ".$file." &", $bla); } ===============code ends Here, all files are opened one after another. The next file opens only after closing the current one. Actually I don't know whether the redirection of the output towards .tmp-files complies with the intended purpose of the redirection. The PHP manual states that when starting programs in background, the output would have to be redirected to a stream or file, otherwise PHP would continue to run until the respective program is terminated (which I really wouldn't care about at all, if it did so...). Then I thought about writing the line I would type manually for opening all ps-files ('gv bla1.ps & ; gv bla2.ps&; ...') into a string and then executing that string: ===============code starts $command=""; $bla = fopen("./trash/tmp", "w"); foreach ($filelist as $i => $file) { if ($i < count($filelist) - 1) { $command = $command."gv $file & ; "; } else { $command = $command."gv $file &"; } } exec ($command, $bla); ===============code ends sadly I get an error message from the shell: ================ error message starts sh: -c: line 1: syntax error near unexpected token `;' sh: -c: line 1: `gv uges_Boden.ps & ; gv ux_Boden.ps & ; gv uy_Boden.ps &' ================ error message ends
View Replies !
XML Form Post To External URL
I'm far enough along in PHP to know how to create input forms, grab the form input as $_POST variables, do some basic validation checks and present the errors to the user for resubmit if needed. For the life of me I can't understand why I can't post data as an XML document to one of my advertisers. For example, a lead form is complete with Name, Address, Phone, and so on. I capture the form data and submit as an XML document. This particular advertiser will only accept data as an "External XML Post." I tried using Javascript and PHP with cURL, but I'm going in circles trying snippets of other people's code -- it's been a week. At this point all I want to do is assume IE7 (nothing else!) and no data checks, just "here's the XML, here's the external URL" and show me that HTTP POST actually works. Right now I'm thinking it's a bunch of junk :-) Someone please help. Here's my server info: PHP Verion 4.4.4 Apache/2.0.46 (Red Hat) CURL support enabled CURL Information libcurl/7.15.4 DOM/XML enabled DOM/XML API Version 20020815 libxml Version 20510 HTML Support enabled XPath Support enabled XPointer Support enabled XML Support active XML Namespace Support active Here's a sample of XML, let's call it "data.xml" <?xml version="1.0" encoding="UTF-8"?> <DataFormSubmit> <individual id="12345"> <FirstName></FirstName> <LastName></LastName> <Address></Address> <Phone></Phone> </individual> </DataFormSubmit> POST XML document to URL on an external website for example: http://www.example.com/othersite/xml.aspx Response XML is equally simple. There is no mention of MethodCall, MethodResponse and Params like the books say, so please don't use those elements in your reply to me. There is mention of field requirements like "Text field" "255 character max" "Numeric" but I think this can be handled by the input validation scripts. I'm just trying to POST and get a response. I've received errors refering to "permission denied" "access denied" "object expected" but at this point I've edited my code so many times I don't know what's right or wrong any more. Here's one of my failed cURL examples: <?php // XML data as string $request = '<?xml version="1.0" encoding="UTF-8"?>' $request .= '<DataFormSubmit>' $request .= '<individual id="12345">' $request .= '<FirstName></FirstName>' $request .= '<LastName></LastName>' $request .= '<Address></Address>' $request .= '<Phone></Phone>' $request .= '</individual>' $request .= '</DataFormSubmit>' // Create Headers $header[] = "Host: www.example.com"; $header[] = "Content-type: text/xml"; $header[] = "Content-length: ".strlen($request) . " "; $header[] = $request; // Send using CURL $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "http://www.example.com/othersite/xml.aspx"); // URL to post curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); // special POST with specified Content-type $result = curl_exec( $ch ); // runs the post curl_close($ch); echo $result; // echo reply response ?> And I tried a Javascript variations using code like xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") but I'll save that for a followup post since this is getting long. Anyone out there doing external XML form post?
View Replies !
External Form That Is Pre-filled
I want to link to another page, and have a form on that page filled out with some data. For instance, a link to the main Google page with the search field filled with some text. I don't want to link to the search results; I just want to link to Google.com with the form filled.
View Replies !
Php Form Processing Program?
Are there open source php form processing programs? I know there are free php form mail code, but if it's classified as open source, I would think any bugs can be fixed much faster. If not, then which free program is the perfer choice?
View Replies !
External .txt Template For Form Processor
I'm in the process of customising a form processor and would like to use external .txt templates for both the primary recipient email and the client autoresponder. For the recipient email the variable $content already contains the input data but I would like to add text to the email that is not included in this variable. Current script config details are outlined below. If somebody could shed any light on how the form processor can be pointed to external .txt files for the body text of the emails to be sent out I'd be very grateful. Code:
View Replies !
How To Parse An External Form And Submit It
I'm trying to write a php script to open an external web page. Fill in a form. Submit the form. And then retrieve the data. For example, From my script, I'm looking to open up a google mail, log into google mail, and then retrieve some data. I'm not looking to parse stuff on my own site.
View Replies !
Main Program Call Another Main [GET]
is it possible to call from a main program another one the same as it is done by the browser? If I begin I am able to do http://server/main.php?name="test" in the browsers URL. Could I do such a submission inside of a program and how?
View Replies !
Program To Process Mail Form
Does anyone know of a [cgi, perl, php, whatever...] program that will process a simple mail form and send the results to 2 recipients? I'm currently using BNB [B]irdcast, but it triggers a user's anti-virus protection.
View Replies !
Sending Data Form A Vb Program To A Mysql DB
Hello, as this falls under both VB and PHP I have posted this into two newsgroups (this is the first time I've done this so if it is mucked up then I'm sorry). Anyway I want to make some simple games with in VB 6.0 and then I want the highscores to go to the server (which uses PHP and MySQL). And if its possible I would also like the highscores to be viewable on the program AND on my site. PHP Part: I think I need to set MySQL up so it can be accesssed from outside of the server, but I'm not sure.
View Replies !
Trouble Passing Form Input To C Program
I'm using exec to start a C program and need to pass it some parameters from a form. It works fine if I hard code sample parameters into the exec call like so: exec('/var/www/argtest 2000 March', $output , $returnStatus); With the following, the C program runs but the parameters do not get passed: exec('/var/www/argtest $year $month', $output , $returnStatus); I searched the forum and found an entry indicating that I should be able to include those variables like that. What am I doing wrong here?
View Replies !
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working. I'm trying to use ftp_exec to execute some simple command: $conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host"); ftp_login($conn_id, "$username", "$userpass") or die("Cannot login"); $command = 'cd..' if (ftp_exec($conn_id, $command)) { echo "$command executed successfully"; } else { echo "could not execute $command"; } ftp_close($conn_id); I'm getting the following error: Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21 could not execute cd.. Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..
View Replies !
Email Form That Uses Array And A Switch Call To Send Values In A Form To My Email
I've got a email form that uses array and a switch call to send values in a form to my email. The problem I'm having is I have a checkbox where users should be able to select multiple values however if they do when I receive the email instead of having the values it prints "ARRAY"...I've included a sample below: PHP Code: <? // Key => (required, type, string) // Types: // 1 - Long text // 2 - Short text // 3 - Textarea // 4 - Radio // 5 - Checkbox // 6 - Dropdown // 4, 5, and 6 require a 4th value in the array $mail_form_to = "me@email.com"; $mail_form_subject = "Real Estate Submission";
View Replies !
Call Function From Form?
Is there a way to pass a parameter to PHP function from a form? Something similar to the way javascript can be called? Or should I just use a hidden form element and grab its value?
View Replies !
Call Like A FORM Request
I am a newbie in php. I googled a while around but I don't get the right information to solve my problem. <form action="list_files.php" method="POST"> email: <input type="text" name="email" > <input type="submit"> </form> Is there any possibility to get my list_files.php called from an other php script submiting the input parameter "email"? Could I do this only if I use the "GET" method? If I have such a string how could it be executed? A simple example how to call it would be fine.
View Replies !
Call Function From <form>
Can anyone tell me if it is possible to call a function from a html form, where the function is included in the same file as the form. <html> <body> <form method="post" action="what do I write here to acces function test()"> <input type="text" name="tekst"> <input type="submit" value="send"> </form> <?php function test(){ echo $tekst; } ?> </body> </html>
View Replies !
How Do I Call $item_number To The 2nd Form?
It's a long code so I try to cut it short and go straight to the point. This code is in one page. This page has 2 forms. The first form will post the variable $item_number to the same page if the update button is clicked. So my problem is in the 2nd form. How do I call $item_number to the 2nd form? From the 2nd form, I want to post $item_number to a page call testpage.php. <?php $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { ............ case 'update': if ($cart) { $newcart = '' foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $item_number = str_replace('qty','',$key); ...............................
View Replies !
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error : Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62 Below is my script : <?php $line1 = exec("ping 10.8.1.70", $output); exit; ?>
View Replies !
External Url
I have tried to make a script, that checks the external url from a popup, but i just get permission denied in javascript. But can this be done in php?
View Replies !
|