Con

Applause

Don't laugh too hard at me  Applause  Applause

How do I pass a variable back to a program which I've run from command line?

Example: This program is mainprogram.

php

 

<?

php

 
$cwd = getcwd();
$cmd = '

php

  '.$cwd.'/mainkey1.

php

 ';
$cmdStatus = `$cmd`;
echo($cmdStatus);
?>


That runs program mainkey1.

php

 

Let's say mainkey1.

php

  reads a file and outputs data into a variable called $main1

How do I get that variable ($main1) which was run in mainkey1.

php

  BACK into this program (mainprogram.

php

 Applause?

I don't just want to do an include because I want to run this within a loop.

I don't know what you guys would call this but essentially I want the ability to "CALL" another

php

  program from within one and take the output of that second program and do what I want with it in the first.

Have I made ANY sense at all?  Applause

Thanks for helping a newbie out.  Applause

Con

Con

Never mind...I got this to work with an include...I'm a dumbass!  Applause

perkiset

NW Con... and the way that you'd do something similar is call program b from program a with shell_exec which would allow you to see the output from program b as a variable in program a. Confusing, I know, but consider:

Program A:

#! /usr/local/bin/

php

 
<?

php

 

$resultsFromB = shell_exec('./programB.

php

 ');
echo "The results of program B are: $resultsFromB";

?>


Program B

#! /usr/local/bin/

php

 
<?

php

 

echo 'Hello World!';

?>


If you chmod 755 program A and B, then run program A, you'd see:

The results from program B are: Hello World

This is REALLY the long way around - the include is obviously better, but this makes for an interesting exercise in any case.

/p

Con

Gracias Amigo...And hope you and yours had a Merry Christmas!  Applause

Con

perkiset

Still having it my friend, hope you are as well. Scoffing wifi from the resort next door to us in MX, so my connection is spotty but good when the air is right. Hope the new year brings you everything you are hoping for.

/p

jammaster82

a buffalo wifi card with 6 foot cord to ma

gnet

 ic antennae 7db boost
would be good for scoffage

perkiset

Love to hear more about that... unfortunately parts are difficult to come by here in MX, but when I return home that sounds like an excellent thing to put together for my road kit. Design plan, parts and instrux thread please?

vsloathe

Buffalo is wonderful. Probably the best wifi card company for reference chipsets, and their hardware works on almost all

Linux

  distros (supported in 2.4.x kernel on I think).

Buffalo card + cantenna is what I use when travelling. I can pick up wifi

net

 works at approx. 1 mile away given decent terrain with few obstructions. As long as the wifi

net

 work is less than a mile away, I get solid reception as well.

jammaster82

Here ya go dude, this guy will sell them both to you on ebay.... or
circuit city had one i picked up about two months ago...

I wouldnt put the ma

gnet

  on my laptop like in the picture though lol....ill
save the ma

gnet

 s for my perpetual motion

mac

 hine but here ya go:


http://cgi.ebay.com/NEW-Buffalo-Turbo-Power-WLI-CB-G54HP-7dBi-OMNI-Antenna_W0QQitemZ200186852295QQihZ010QQcategoryZ40992QQtcZphotoQQcmdZViewItem



Works wonders where i am signal less and pops on the car hood like old
school cellie antennae coulda scoffed from linda carters dads building
with this from 43rd and Glendale...hahaha



perkiset

That looks sweet, although my Powerbook has the new expressport rather than the standard shape pcmcia... I'll look at the USB version and see if that can help me out. Thanks man

ratthing

If you don't want to make your own antenna, Hawking makes some nice ones for low cost as well.

=RT=


Perkiset's Place Home   Politics @ Perkiset's