Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Output of a dos .exe into PHP variable
Old 08-12-2009, 01:19 PM Output of a dos .exe into PHP variable
Junior Talker

Posts: 2
Name: Chris
Trades: 0
I have a Newport temperature monitor that I can query using httpget within a CMD box. However, when I try to use the system function in PHP it will not allow me to place the output in a variable. It just displays the output within the browser page. My goal is to split the data string and place them into a mysql table. I appreciate any help anyone can give me in how to get the output to a variable or a better way to get it into a mysql table.

Thanks

Example:
PHP Code:
<?php
echo '<pre>';
$temps system('c:\httpget -r -S ERDGALL 192.168.100.210:2000 -C1 -q'$retval);
echo 
$temps;
?>
chrisa is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-12-2009, 01:38 PM Re: Output of a dos .exe into PHP variable
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Try using exec. System should be returning the last line of command line output. Exec works the same way except it allows you to specify a reference to a variable to store the entire output in:

PHP Code:
$output;
exec('my command'$output);
echo 
$output
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 08-12-2009, 02:36 PM Re: Output of a dos .exe into PHP variable
Junior Talker

Posts: 2
Name: Chris
Trades: 0
Thanks!

It just said Array in the browser when I did it with echo $output.
So I changed echo $output to $output[0] and it is now working.

Much appreciated.
chrisa is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Output of a dos .exe into PHP variable
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.84089 seconds with 12 queries