Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1938 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

system commands/ save results

Thread title: system commands/ save results
Closed Thread    
    Thread tools Search this thread Display Modes  
10-12-2005, 01:35 PM
#1
ktsirig is offline ktsirig
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
 
Posts: 46
iTrader: 0 / 0%
 

ktsirig is on a distinguished road

  Old  system commands/ save results

Hi all!
I call a system program through PHP, using the system commands provided by PHP (like system, exec etc)

Q1: Is there a way (I think using the return values) to make sure that the program has run? I mean, not take the data from the program if the program has encountered any kind of internal error and didn't ran correctly.

Q2: How can I pass the data that I take from the program to a string, in order to handle them and present them to the user the way I want?

The command I use is something like:

$command = shell_exec ('program_name argum1 argum2');

argum1 and argum2 are arguments that I feed the program with.
Will the '> tmp_file' store the data I take as result from the program into the tmp_file or must I use something else?
Thanx

10-13-2005, 06:55 PM
#2
UrlTrends is offline UrlTrends
UrlTrends's Avatar
Status: Junior Member
Join date: Jan 2005
Location: Sacramento, CA
Expertise:
Software:
 
Posts: 68
iTrader: 0 / 0%
 

UrlTrends is on a distinguished road

  Old

Q1: You will have to parse the output of the command you run to see if it processed correctly. To do this see Q2.

Q2: See below:

PHP Code:
exec("[cmd]",$cmdresult);
foreach (
$cmdresult AS $cmdresultline) {
    
$result .= "$cmdresultline\n";
}

echo 
$result

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed